« first day (2477 days earlier)      last day (2470 days later) » 
00:00 - 16:0016:00 - 00:00

12:06 AM
@micsthepick what is your question?
 
1 hour ago, by micsthepick
So I want to find out why my program is not returning the shortest path when the way it works, it should look at each depth level in order.
 
for those of us who weren't around earlier
are you certain that the current pastebin is minimal?
 
Everything inside it is necessary
 
I strongly suggest that you learn how to debug your code. You can either add print() statements throughout your code to print messages that indicate which lines are executing and show values of the variables involved. Or you can use a source-level debugger from an IDE like PyCharm.
Debugging skills are critical for a programmer.
 
@Code-Apprentice Its not an error
And I am confident in my debugging ablilty
 
12:09 AM
which is why you need to debug your code
step through it line by line and check that each line is doing exactly what you think it should do
eventually you will find a line which does something different than what you expect...
then you have to figure out why and find a solution to fix it.
 
12:24 AM
Well, I did find one bug, but assuming that I cant debug is IMO quite offensive regardless
 
it is not
we don't know anything about you except that you come and expect us to find the semantic problem in your 300-line code which we know nothing about
 
assuming that someone here will debug your code for you is inconsiderate of others' time.
 
I haven't asked anyone to do anything for me yet
 
neither of us claimed that you did anything like that
 
perhaps I misunderstood the reason for you posting an MCVE.
 
12:31 AM
2 hours ago, by micsthepick
So I want to find out why my program is not returning the shortest path when the way it works, it should look at each depth level in order.
original post ^
 
You seem to be asking "Why doesn't my code give the correct output?" The only way to answer that is to debug your code.
 
that's passive agressive for "please help me find out why my program is not returning the shortest path" in any reasonable social frame of reference
 
Wow, is this Facebook ?
 
I don't see a prod button. I'm told facebook has a prod button.
 
12:33 AM
prod? as in herding cattle?
 
*poke
shows how much I know facebook
 
yes...so a cattle prod
 
Is poking still a thing? :'D
 
@KristianHareland pokes
:P
 
I don't use facebook, either.
 
12:35 AM
hehe
 
Ticklish? ;)
How's everyone doing?
 
 
1 hour later…
2:08 AM
Which library is the more common to make GUIs?
 
 
1 hour later…
3:21 AM
late late late late cbg
 
cbg...
 
3:41 AM
Take a function from a module and assing it to a variable in the actual module isn't a waste of memory?
I mean:
#a.py
def A():
    do_something()

#b.py
import a
A = a.A
 
why would it be a waste of memory?
also, you should import what you need
from a import A
 
 
2 hours later…
5:33 AM
I ran across a question about getting time from NTP, and I found a few questions that are very old.
This answer in particular shows how to use NTP: here
but the requirements for it are really bad, in how it is requirement admin. I have a very simple version that works fine. I'm debating:
should I make a new answer
or edit this one and just it in. But it would require massive changes to the answer, since the admin requirements are not needed anymore
I feel like it would be more proper to make a new answer
 
@idjaw please do, but setting system time on nix requires admin anyhow
/ is a privileged op
@EnderLook ...
 
@AnttiHaapala I already added an example in this answer: stackoverflow.com/a/908649/1832539
to help show how to use it. Asked Alex if it is still active too
it works, so must be 😀
and yeah, you know what. that particular question is probably bad because of the requirement of modifying the time.
I'm going to ignore that one actually and I think I might dupe the other two
 
5:59 AM
ntp is much more than a stupid web page though.
 
I updated that one. That works now. So that's good.
So, this all started because of this answer: stackoverflow.com/questions/45364763/…
I removed the third one because of the requirement to update the system time.
 
 
2 hours later…
8:20 AM
good :D
@idjaw requirement was also "without ntplib"
 
8:38 AM
Hi, i was wondering about some best practices considering using multiple modules from a main file. I'm wondering if i should put main() functions in each module and then call those from main.py, or put module_main() functions directly in the main file
I'm leaning toward the first option, but i'm interested in opinions of people who have done such stuff before
 
8:55 AM
@idjaw only 16 upvotes and I'll be d*cked in :D
 
9:49 AM
Jun 17 at 22:06, by Andras Deak
Jun 9 at 16:52, by Andras Deak
Apr 30 at 20:48, by Andras Deak
Mar 21 at 8:27, by PM 2Ring
@Drizzy In the mean time, here are a couple of articles that explain a very important difference between Python and most other languages. Other languages have "variables", Python has "names", and Facts and myths about Python names and values, which was written by SO veteran Ned Batchelder.
read those posts, they're short and highly enlightening
afterwards you'll see why you needn't worry
 
Cabbage
 
10:21 AM
cbg
 
11:12 AM
hi;
Can I answer my own question in Stack Overflow?
 
of course
there's even an option for it when you ask a question
just make sure it's a proper, informative answer as anyone would give
You can also accept your own answer if 2 days have passed after asking your question (I think).
 
Ok
I upload my question and answer it then , right?
 
11:27 AM
when you're writing your question, there's a checkbox that says "I want to asnwer my own question"
if you tick that, you can write your question and answer in parallel and post those at the same time
but if you're writing a self-answered Q&A make sure that it's a good one, because in my experience people tend to be more strict with those kinds of posts :)
the most important thing is usefulness to future readers
 
thanks
 
11:54 AM
Hi everyone, I have a question about selenium use on WebDriver:
have an element in my WebPage and this element has no "href" in its HTML code, but the element is clickable and drives to another page, so what I want to do is to open the page in a new window or tab. When I use the key_down(Keys.CONTROL).click(element).key_up(Key.CONTROL).perform() this just opens the new page in the same window. So even right click (context menu) doesn't contain the open in new Tab/Window.
What would be the solution?
 
@AnasBouayed please 1. don't ask about your fresh questions here as per the room rules, and 2. don't post questions as answers!
 
@AndrasDeak the question already exisits and didn't get any answer
 
then again if you delete your "answer" and just ask this here, it'll be fine
I won't be able to help you, but asking about an old unanswered question is good use of this room
 
problem in this question is that the Question owner didn't provide all needed information and I have no right to comment it (only 29 reputation) so I added it as answer
 
You're also saying that the existing question has missing information, so I'm not really sure that your one would be an exact duplicate. Besides, we can only close posts as duplicates of others that have answers. So if you ask your question on the main site with all relevant information and in a good, answerable way (with the usual considerations of How to Ask and an MCVE), it could be fine.
 
11:59 AM
Ok thank you
 
note that the existing question is 2 years old, and OP didn't clarify their question there
so either wait for an answer here (I can't tell how answerable your question is), or ask on main
 
I will do that! thanks
 
but if you ask on main, it should be much more complete than your now-deleted answer:)
 
8 to gold
earned at least 200 reputation on 84 days
I am soon running out of objectives
 
12:07 PM
lol
for once I didn't see that come
 
12:18 PM
in hindsight it might be doing nothing at all since we are already inheriting from the specified class — Vasili Syrakis 5 hours ago
So it seems the answerer didn't have a particular reason in mind when he called super from the class level.
 
hehe
and anyway wouldn't that just be a no-op?
doesn't super(cls) return a class?
 
I think we decided yesterday that calling super doesn't do anything if you don't touch the object it returns.
 
OK, that's what I thought
I saw the part of the discussion about where you can call super, but not the part about what you do with the return value
 
But yeah super(cls) should return a proxy object that behaves like the parent class(es)
 
thanks
 
12:34 PM
On second thought, I have decided that I have no idea what super(cls) does.
class A:
    def troz(self):
        pass
    @classmethod
    def frob(cls):
        pass

class B(A):
    pass

obj1 = super(B)
obj2 = super(A)
print(hasattr(obj1, "troz"))
print(hasattr(obj1, "troz"))
print(hasattr(obj2, "frob"))
print(hasattr(obj2, "frob"))
#output:
# False
# False
# False
# False
So super(cls) returns... An object which has zero of the attributes that cls has. OK then.
I think I must be misunderstanding what the docstring means by super(type) -> unbound super object
 
>>> obj1
<super: <class 'B'>, NULL>
>>> obj1.__thisclass__
<class '__main__.B'>
oh that's "the class for which we're querying the super"
thing is, those super objects have barely any methods/attributes
wait, this is all the 1-argument form of super; does that not make a difference?
 
The docstring indicates that one argument gives you an "unbound super object". Zero or two arguments give you a bound super object.
 
So it makes a difference in that sense.
 
I mean, "ah"
 
12:46 PM
\o
ahoy
 
I bet there's a more comprehensive explanation out there somewhere that gives more information than the docstring but I can't look for it until the end of the fifteen minute cooldown on my "give a darn" ability
 
just got pinged about a dupe to hammer this with this
thoughts?
 
@idjaw I think the former is a better solution than the latter
But the comma makes a difference here
 
Yeah, I'm stuck at which way to go or even to dupe at all
 
12:56 PM
I would say: In doubt, don’t
 
I keep coming back to a problem with my Tkinter program and I have not found an answer yet.
 
yup ok. will not dupe. thanks @poke
 
from tkinter import *


main = Tk()
txt = Text(main)
txt.grid()
btn = Button(main, text="Delete everything", command=lambda: txt.delete('1.0', END))
btn.grid()
btn1 = Button(main, text="Grid forget", command=lambda: txt.grid_forget())
btn1.grid()
btn1 = Button(main, text="Destroy widget", command=lambda: txt.destroy())
btn1.grid()

main.mainloop()
how can I free the memory used by text in a Text() widget?
 
Also try del txt to make sure that the reference doesn’t keep the object in memory.
 
if you take the example above, past a text document or some other large amount of text into the widget several times you'll see the memory usage grow in task manager. If you delete the text, destroy the window, or do a grid_forget it will not free the memory used
one sec
 
1:00 PM
The txt.something thingies probably only remove it from the view, but will not clear up the memory used by Text object.
rbrb
 
rbrb
 
@poke txt is the widget so running del txt fails
 
In CPython, the memory that the process has allocated is not strictly proportional to the memory that is actually being used. I forget the details, but I'm sure that after objects are garbage collected, the space they took up is kept around for some amount of time to see if any new objects can fit into it
This is fairly typical behavior for projects with nontrivial memory requirements
 
can we annotate objects?
django?
 
I've read about that but if I destroy the txt widget and recreate it with other txt the memory doesn't get reused. it just keeps growing and growing. This forces me to close the application at some point and relaunch
 
1:06 PM
by "destroy and recreate" do you mean calling txt = Text(main) again?
or in the txt.destroy() sense?
 
txt.destroy()
and then running txt = Text(main) when its created
 
Mm hmm, I was about to say "... But the text contained by a text widget is almost certainly not a formal Python object, so it may have its own ideas about memory usage"
 
googling "tkinter destroy" doesn't give me any tkinter docs hits in the first handful of search results, which I find disconcerting
 
If that particular part of Tkinter is implemented in C, then pretty much anything goes
 
@sidnical if I understand correctly how garbage collection works, txt = Text(main) should be enough since if there are no other references to the old Text object, it should get garbage-collected
 
1:08 PM
Three questions on the first page are closed as the same dupe right now. Two are closed as another dupe. I sense a great day ahead.
 
@AndrasDeak Certainly I would expect that to garbage collect the old Text object. But it might not collect the text that the old Text object contained.
 
are there not turtles all the way down?
 
@Kevin Not just projects, but the OS as well might keep memory around, if a program allocates large chunks. See man mallopt on linux, for example.
 
There are turtles all the way to the bottom of the segment of the tech stack where Python has any say in what happens. Once we're invoking Tcl methods, Here There Be Dragons
 
ah
seriously, no "destroy" in the tkinter docs? docs.python.org/3/…
no Text in the table of contents either
 
1:12 PM
The official docs are pretty spare when it comes to Tkinter. Their philosophy is pretty much "this is a thin wrapper over Tcl and it's not our job to document that"
There's always the unofficial-but-best-we-got effbot.org/tkinterbook/widget.htm#Tkinter.Widget.destroy-method
 
aha, apparently there's a section of the docs titled "tkinter widgets" that I'd expect to exist but don't
this is bad
 
"Destroys the widget. The widget is removed from the screen, and all resources associated with the widget are released." = lies
 
wait
txt = Text(main) -> considering all the black magic, I'd find it likely that main holds some references to the object
 
Yeah, it does. You can access all the child widgets of a widget without having any explicit reference to those child widgets.
 
main.winfo_chilren()
I bet 0.25 quatloos of Kevin that destroying the object doesn't affect these references
 
1:17 PM
My guess is that it does, but I'm unwilling to wager even imaginary money on it
 
good call
def destroybutt():
    print(main.winfo_children())
    txt.destroy()
    print(main.winfo_children())
[<tkinter.Text object .140086540301032>, <tkinter.Button object .140086540301424>, <tkinter.Button object .140086536421328>, <tkinter.Button object .140086536490176>]
[<tkinter.Button object .140086540301424>, <tkinter.Button object .140086536421328>, <tkinter.Button object .140086536490176>]
 
\o cbg
 
KEVIN'D
on a question....
 
You'll get the next one.
 
1:24 PM
Is the text just stored in memory or does the widget keep everything in a variable somewhere?
 
.... variables don't live in memory ?
 
@Kevin something is not sitting right with me that they are using dict as an argument name, even though it does take a dict....it just seems that still should not happen.
 
@sidnical My expectation is that there is no variable.
 
k
well darn
 
@idjaw Mm hmm, and I can't say I care much for using .get over regular indexing.
 
1:28 PM
If you don't want an exception then it makes sense...or if you want a default argument to replace it
I've seen things like:
d.get('thing', {}).get('other', {}).get('yay')
 
I expect .get to be the correct choice maybe 30% of the time, so without any additional evidence for its necessity I look at it askance
 
FYI python-tag-related meta about answering/closing too broad questions
I left my grumpy two cents and some
 
how to covert python coding to asp.net c#
 
Learn both languages, then use critical thinking to turn one into the other
 
solid advice
 
1:40 PM
@Kevin no other way?
 
"Ok but that sounds like a lot of work. Is there an existing project that automatically does that on my behalf?" you ask. I don't know. That sounds like a very big undertaking.
Like thousands and thousands of man hours.
 
my project full of python coding thats y
 
There is no other way. Next question.
Preferably "next cat picture".
 
Here's a question I'm pondering: how hard is it to relocate a light switch in my house?
 
pretty
 
1:44 PM
@Kevin have you already located it?
Re-locating it shouldn't be hard in that case.
 
Every night I have to walk four feet in complete darkness because the switch is near the middle of the room instead of by the staircase where it would be more convenient.
 
the obvious solution is a voice-controlled switch
or in your case, brain waves
 
It would be interesting if there was a product where I could splice in a little radio transmitter or something, which communicates with a base plate that I could put elsewhere on the wall. Then I wouldn't have to cut through any drywall.
 
it's not just cutting; you'd need to find or move a piece of the same wire that's split at the existing switch
so either you move your switch location along the wire (and in any case you'd have to know where it goes), or move the wire itself in the wall. Neither sound like too much fun
 
1:53 PM
@Kevin Sounds like literally any smart home setup these days.
@davidism I wonder how you make “clap on” and “clap off” sounds, or rather, how those sound different enough for such a device to know which clap you just did.
 
umm...toggle?
 
You clap with the right hand for "on", left for "off".
 
@davidism hugs that was great
 
I cannot do single handled claps
 
1:56 PM
Do you have claps lock on?
 
Also, is it the other way around for left-handed persons?
 
the trick is, it can tell based on the acoustic difference between a left hand and right hand. You have to tell the device if you are dominantly left or right
and it will know based on the louder clap which one is left and right
it's a very smart device
the future is now
 
It does sound so
 
I should make an IoT for this thing. So I can send it claps over the internet
 
To get left-handed functionality you merely need to unplug the cord, rotate it 180 degrees, and plug it back in.
 
1:57 PM
oh the possibilities!
 
@idjaw rule 34 would kick in fast
 
@AndrasDeak poor clapper.....
it just wanted to turn lights on and off for people
 
something something s/cl/f/
 
There's an old webcomic floating around where the main character installs a clapper on their TV and whenever they watch a game show, it spontaneously turns off because of the audience's applause
 
2:12 PM
friday cbg...
 
@AndrasDeak I’m pretty sure remote clap devices already exist.
@Kevin Reminds me of that xbox one presentation where the announcer at some point showcased the voice command functionality and said “xbox go home” and apparently all the people streaming the show over their xbox disconnected because their xbox went to the start screen.
 
Demonstrating that technological innovation will never trump human stupidity ;-)
 
2:28 PM
What he said
 
@AndrasDeak Thanks for the links! I have just read the first now I reading the second link.
 
no worries
 
DSM
Friday morning cabbage for all.
 
2:48 PM
Yeah, that was good too @Morgan
 
3:14 PM
\o cbg DSM and Ender
 
which ender? :o
 
yammit!
more double names
 
in doubt both
 
smashes fist on table
no more of this!
when I become president, all names are unique
ALL!
 
@idjaw I’m really surprised that I’m still mostly alone on SO despite my short name.
 
3:26 PM
no one has lived to tell the tale.
You're doing well, sir.
if I find another idjaw.....oooooooh the great lego war will start.
 
he poked them all until they caved
 
There is one other poke with more than 1k rep. And only three more that have more than 100.
 
I'm also happy to be alone with my name...at least on SO :|
 
Well, having your full name is kind of cheating though
 
DSM
There are lots of DSMs, but I don't think I've come across another one.
 
3:28 PM
Happy to see our Kevin on #2 though.
Although, only #2…
 
there is a more powerful kevin?
THERE IS!
 
Indeed there is
 
DSM
Who also writes in C#.
 
That timeline must be insane
 
@idjaw luckily we don't have the same avatar
 
3:31 PM
@idjaw - are you happy now?
 
#2 ain't bad, I'll take it
 
@unique lol. haha. (you didn't have to...but lol)
 
@unique wait, who were you before? I’m confused?
@idjaw What if the other idjaw is a playmobil figurine?!
 
PaulMcG judging by the avatar
 
oh, right
 
3:34 PM
uinque, are you aware of the name-change-per-every-30-days rule?:)
then again it hasn't been too long since your last change
@poke ( ͡° ͜ʖ ͡°)
 
Feature request: Toggle for GitHub searches to skip all test files.
 
(figurine is clearly the female form of figurine)
 
Yes, it is I, PaulMcG
 
--said the suspicious stranger
 
Or in the spirit of Monty Python we can all change our names to Michael - will make things much easier
 
3:39 PM
s = "Krishna"
print(s[-1:-2])
Why the output is Empty?
 
because it’s a forward slice from the last character to the second to last character.
And if you go forward from the last character, you cannot really expect to get anything back
 
morning cbg
 
Your right . Bit at at least it will print "a" right?
But*
because it is starting index right?
 
It wouldn’t if the slice end wasn’t before the start
It’s like s[2:1] also returns an empty string
 
@poke oh my....I haven't thought about the True Nemesis
That would be....that would be catastrophic.
 
3:45 PM
Thanks poke. It is really helpful
 
You could do s[-1:-2:-1] though to go backwards instead
 
that would be a bit superfluous though
 
@idjaw I’m imagining a pretty epic battle
 
Playmobil people don't have arms but they make up for it in incredible cunning
 
But they have arms..
 
3:51 PM
I'm questioning Kevin's childhood right now
 
Thanks poke
 
Hmm if playmobil people have arms, what am I thinking of? Toy figures that are just basically smiling pegs.
 
wut
 
Ah ha. Sorry, I was thinking of Playskool.
 
 
3:56 PM
Is SO wonky for anyone else? I'm getting slow page loads and slow responses when posting comments.
 
@Kevin I was just about to link that to you and i don't think those are playmobil
 
Surprisingly, it looks like the two companies are not at all related?
 
Is that so surprising?
 
Given they both exist in the category of "blandly happy plastic figurines for kids", I would have guessed that one was a subsidiary of the other, targeting a different age range
Playskool being for younger children, since the round shapes are safer when swallowed compared to the pointier Playmobil
 
hmmm...I can see that logic
like Duplo and Lego
 
3:58 PM
Yeah
Also both of them have typos in their name. "skool" and "mobil" are not words.
 
00:00 - 16:0016:00 - 00:00

« first day (2477 days earlier)      last day (2470 days later) »