« first day (1750 days earlier)      last day (3181 days later) » 

1:10 AM
TMNT on NES. Ending was horrrible!!!!
 
1:53 AM
Too much mead :|
 
 
6 hours later…
8:08 AM
Hey up
 
 
2 hours later…
10:07 AM
@Paullo Please don't link newly asked questions as per sopython.com/chatroom
 
 
1 hour later…
11:16 AM
Why does appendTable("delay"); for title in ["delay"]: appendTable(title) fail if appendTable("delay") succeeds?
 
Can you format your code properly?
 
What does it mean?
appendTable("delay"); for title in ["delay"]: appendTable(title)
 
It's difficult to tell what your code is doing, is it really all on one line?
 
What is it meant to do? Both halves do the exact same thing.
 
11:20 AM
it calls appendTable("delay") twice.
 
Yes I understand that part. To be honest I'm struggling with what you want in general.
You've not really explained your issue.
 
It prints out a delay table and then several optional tables.
 
That tells me nothing. If you want help please provide an MCVE stackoverflow.com/help/mcve
 
cabbage
 
Hey up
 
11:29 AM
@Ffisegydd Noice
@RecognizeEvilasWaste Yeah. But we can't know why it fails if we don't have a definition of the appendTable() function.
 
12:08 PM
Take appendTable(title): print title as defition.
I tried (appendTable(title) for title in ["delay"]) but it produces a generator for me.
Seems that [appendTable(title) for title in ["delay", "pause"]] does the trick.
 
That creates a list and is very unpythonic (bad) code.
Why not just do:
for title in ['delay', 'pause']:
    appendTable(title)
Also you should not use semi-colons to write two lines of code on the same line, it's bad practice and very unreadable.
 
What Ffisegydd said. Don't use a list comprehension unless you need the list that it produces. Creating lists full of None and then throwing them away is not only wasteful, it also makes your code harder to read for no good reason.
 
12:29 PM
I do not know why it is unreadable. In programming, you group related items by using spaces. Closely related items should be placed together. Using one line is best grouper.
It also balances code. It is better to have things balanced when code spans the page rather than doing everything in the first 10 columns, leaving 80 other columns for the useless white space.
 
It's really not. Put them on separate lines without an empty line between them if you want to "group" them. Never put things on the same line.
I've been using Python for 7 years now, yet when I first read your code I was confused and had to ask for clarification, because it just looked awful.
 
The fact that you are accustomed to something does not mean that alternative is bad.
 
Not only that, but I'm not sure that using ; will always work.
 
@Ffisegydd Indeed.
>>> a=5;for i in range(a):print(i)
  File "<stdin>", line 1
    a=5;for i in range(a):print(i)
          ^
SyntaxError: invalid syntax
 
My argument wasn't that "I'm accustomed to something and therefore the opposite is bad", my argument was "The majority of Python programmers follow this method, if you intentionally go against the grain then you're intentionally making their lives more difficult"
And when you need someone's help to debug a simple for loop, making our lives difficult isn't exactly a good idea.
So please, read PEP8 and be considerate with your code formatting when coming to us for help.
 
12:36 PM
@RecognizeEvilasWaste Coding conventions make it easier for programmers to read & understand each others' code. A little bit of individual variation doesn't hurt, but ignoring core principles of the conventional style makes it harder for others to help you with your code.
 
12:55 PM
@Ffisegydd for-comprehensions make loop debugging a hell. We should avoid them.
 
Excuse me?
I don't understand your point.
 
I do not see how f(x) for x in [] is debug-friendly whereas for x in []: f(x) argues against one-liners.
 
I never said f(x) for x in [] was debug-friendly.
Quite the opposite.
 
Then, you say that for-comprehensions is a bad programming practice. I just envisioned this your argument.
 
If you're using functions which don't return anything, or you don't need to store what they do return, then using a list comprehension is unnecessary (creating a list of objects you'll never use).
 
1:00 PM
That is another thing. Your argument was that one-liner loops are bad (should not be used). Despite of that, for-comprehensions are considered a big advance over the imperative for-loops.
They are utterly Pythonic.
 
Okay so if I need to iterate over a million functions but don't care about their return values, I should use a list comprehension? I should create a list of length a million for no reason? Great logic.
You can take my advice or leave it, I don't care.
 
The great logic is that one-liner for loops are bad but for comprehensions are fine and should be preferred in functional programming, which should be preferred to imperative programming.
 
Okay I'm getting fed up of this now.
 
Who cares? If you don't like comprehensions then by all means write longer code
Just don't use dogmatic rules to justify your preferred style. Comprehensions are both natural and time-saving to many Python programers, but anyone who understands them will understand for loops too
 
@holdenweb so you're saying that I should create a list of million objects if I need to iterate over a million function calls, say?
Anyway, unfortunately I'm in the middle of playing a video game with t'missus so don't have time to debate/argue the point :P
 
1:09 PM
@Ffisegydd of course I'm not. I agree that the use of a comprehension just for side effects is lunacy. But since the OP doesn't seem inclined to listen to your words of wisdom, let him do what he wants too. I didn't have the full context when I made the above comment
 
Ah ok :P thought you were losing it there (or, more likely, I was severely wrong)
 
Unfortunately? Enjoy!
 
Hey guys,
if I have to return some data[list,tuple,dictionary] using Flask(python framework) on browser, Is the only way to convert that into json first?
 
user559633
1:23 PM
@arshpreet You can return that as raw content in the template or as a string value.
 
Yes, that is a second argument against for comprehentions. They are debug-hostile and, secondly, create too long lists (at least in extreeme cases). Given all of that, why to bother to use them at all?
 
user559633
@RecognizeEvilasWaste Because list comprehensions are useful and can be a pleasant way to express your logic.
 
@RecognizeEvilasWaste Nobody's saying don't use list comprehensions. We're saying don't abuse them. There's a difference
To go back to your example, [appendTable(title) for title in ["delay", "pause"]], where appendTable() returns None` is not Pythonic. You should use a normal for loop on two lines for that.
If I'm reading code and I see something like that, I take it a sign that the coder doesn't really know what they're doing, so I have to slow down and keep a lookout for other crazy stuff in the code.
And even though I love list comprehensions and generator expressions I happily admit that they can make code overly dense, especially if they involve more than 2 or 3 nested loops, so I'm happy to expand such code to use a normal loop if I think it will improve readability. For example, see the code I posted in this recent answer
 
1:48 PM
@MartijnPieters: I agree that the English isn't great in loop “for” in python, but it's not that unclear. The OP wants [w[1:] if w.startswith(('(', '+')) else w for w in sent]
 
2:38 PM
Guys why would I get "connection refused" when I try to access my django server if manage.py reported no errors while using runserver?
 
@Meaty: are you accessing it on the same ip address as runserver has bound to?
 
I'm trying localhost:6113
just to be sure, I forwarded 6113, even though I don't think it would be needed here
 
Hi, wanted to understand ucs2 and ucs4 compiled python
 
hmm runserver usually uses port 8000 for me
 
It does not state any errors. It simply says Connection refused: 127.0.0.1:6113
same for 8000
 
2:41 PM
maybe that's just a setting though
check your firewall I suppose
 
I'll try, what do you think might be causing the problem?
I mean I'm not sure what to allow; opera, python or something else?
 
I don't know how your firewall works, but I usually just specify the port
you could just check if it's the firewall in the first place by disabling it briefly I guess
 
Yeah, I'll do that. Allowing Opera didn't help.
 
I'm proud I answered to a question that had no satisfactory answer (from my point of view) and used cog for the first time
 
Not solved, I tried making another project, then I've done migrating, then runserver and still connection refused
Lol, would you look at that!
I hosted on my static router's address, with port I forwarded recently, tried to access it from another laptop and it works
 
2:54 PM
@XavierCombelle Interesting. cog looks like it could be very useful.
 
So, I just can't access it locally, after win10 upgrade...something smells fishy
Btw good job there, I don't see that time coming for me any time soon lol
 
meaty: and doing runserver 0.0.0.0:6113 also fails?
 
Yes, now I just noticed it's not working on Opera only!
It even works on Edge, that was the last thing I expected to work lol!
 
DSM
@PM2Ring: I promise I didn't read your comment here before I commented on this question..
 
3:01 PM
Yeah, from the start I thought it may have been my lack of knowledge that caused this lol.
It seems opera is blocking connection to localhost somehow, it didn't appear that way in Win8.1 though.
 
@DSM Ok. I believe you, although millions wouldn't. :) I was hoping to post an actual answer, since answering questions in comments is discouraged. And I was hoping Martijn would re-open the question after I tidied it up...
 
DSM
One more re-open vote needed, for anyone so inclined..
 
It looks like the OP's happy with your suggestion. But I guess one of us ought to post an actual answer if/when the question gets re-opened.
 
DSM
You have priority + I'm too lazy. :-)
Reopened; the field is yours!
 
Thanks, DSM.
Oh-oh. There's a war breaking out in these comments.
 
DSM
3:12 PM
When the comments have gone off the rails, do we flag one and hope the mod reads 'em all or the question and explain the problem?
 
@DSM or close the question
 
@PM2Ring Did you see the first revision?
 
not helpful to anyone
 
There was no question there at all to start with.
 
hmm
I guess they are testing now :P
There are an unusual number of requests coming from this IP address.
 
DSM
3:19 PM
Heh, just got that myself. Was wondering if I was clicking through the revisions too quickly. :-)
 
silly stackoverflwo
 
@AnttiHaapala I just got that message, too.
 
Got same
 
I guess it is because there is no backoff in some ajax requests
because I wasn't doing anything at all really
 
Site give into read only mode, probably just hit a transition glitch
 
3:21 PM
oh well
buhuhu
 
While they were switching for some reason
 
Yup, I got it too.
 
@MartijnPieters I only had a brief look at the revision history when I edited the question. But I see what you mean - it was horrible before you closed it. I didn't realize that the OP only made it answerable after you rightfully closed it. I'll try to look more closely at the full revision history in future.
 
And I was going Thanks, I'll handle 500 flags on a saturday morning again, shall I?
 
I can imagine that felt somewhat... Disheartening :p
 
3:25 PM
@PM2Ring also funny how he writes his name with accents and everything in Vietnamese and then does not even use shift when writing English ;)
 
@AnttiHaapala Maybe he has his name on a hotkey.
 
I guess so ;)
 
lol, that would be sad.
 
It is not that hard to type though, if one's using TELEX it is enough to type Nguyeenx Baor
 
I ran into that new user 'i squared - Keep it Real' earlier tonight - stackoverflow.com/q/31760104 I get the feeling that his mathematical skills aren't as good as he thinks they are...
@AnttiHaapala Interesting
 
3:31 PM
yeah, I've seen it. impulsive personality lol
 
@Meaty Oops. He's not that new, despite the 3 point rep - he's been a member for a year & 10 months. But I guess he's new to Python.
Morning, Morgan.
 
Probably yeah, I've been moving around before deciding to stay at Python too. :)
 
And we're back!
 
3:47 PM
meow
 
4:05 PM
It's a beautiful morning, chaps. How are you all?
 
I still haven't even looked out the window
Working on my pale
4
 
Hungover and rainy. So, not terrible.
 
cbg all
 
4:29 PM
Nachos!
 
so what's the state of Python GUI programming these days? What libraries are people using?
I need to make a really quick in-house application that has a few forms and can display a few charts, nothing particular complex.
Oh and should I even bother? I see people making web front ends for a lot of things these days...
(i'd really rather not have a dependency on a web server if possible)
 
4:46 PM
Tkinter seems popular for GUI programs, since it's usually packaged with the standard Python distribution these days. It's not fantastic (I usually use GTK2+ myself), but it's ok. FWIW, I've been learning about it over the last few weeks, mostly so I can answer Tkinter questions on SO. In fact, I just answered one a few mnutes ago.
 
Just curious, why do you prefer GTK2 over Tkinter?
 
I haven't tried Tkinter, but I've been really enjoying wxpython.
 
@shuttle87 GTK2 is rather more powerful than Tkinter, and (I think) a lot more flexible, with heaps more pre-defined widgets. But the downside is that it has a much bigger learning curve.
 
Ok, I don't really mind a heavier learning curve because I need to have something I can write GUIs for in house things quickly.
 
I've been using GTK2+ for 6 or 7 years, so I've invested a bit of study time into it. OTOH, I don't write lots of GUI stuff, so I wouldn't call myself a GTK expert - it's hard to remember all that stuff when you aren't using it regularly - but I'm pretty good at negotiating its docs. :)
@shuttle87 For simple stuff, Tkinter's adequate. But if you do try to get too fancy you may find it frustrating. Kevin's got a large list of stuff about Tkinter that he's not happy about...
 
4:57 PM
I also don't write lot of GUI stuff, it's just that when I do need to write something quick with a GUI I find myself reaching for C# but that's not so nice for linux.
 
When I decided to go with GTK it was definitely superior to Tkinter. GTK was famous due to being the library that was built to create GIMP with, and Tkinter GUIs tended to look pretty crumby and amateurish. So there was no contest really. :)
Tkinter looks better these days, but its documentation is still rather skimpy. OTOH, GTK docs can be a bit formidable, since there's just so much stuff in there. However, the standard GTK tutorial is quite good, and when you're getting started with GTK the tutorial is adequate documentation in its own right & you rarely need to look directly at the real docs.
 
How easy is it to use things like OpenGL?
 
@shuttle87 I can't help you there, but AFAIK OpenGL is great for doing graphics, but it's not really designed to run a GUI.
But I think there might be GUI systems built on top of OpenGL.
Take a look at the Tkinter docs. If you're comfortable with Python and you've done GUI programming in other languages I'm sure you'll pick it up quickly. Because it's a fairly small system you'll be able to learn enough to start doing simple stuff almost straight away, and if you don't like it, well you won't have wasted too much time. :)
Anyway, it's getting very late here, so I'll say "rhubarb".
 
5:17 PM
@PM2Ring I'm aware of that, I'm just curious if I can have a widget that contains OpenGL stuff
thanks for the chat, good to hear from people that are actively using GUI stuff
 
"working on my pale" - good one.
yay, I thought I lost my mojo, but I didn't! Woot.
 
5:46 PM
Hey Steve, what's up?
Gotta go radio silent for a bit, cheers, folks!
 
6:01 PM
evening cbg all
Ahh huh... new season of Would I Lie To You? \o/
 
6:37 PM
cbg
 
cbg Antti
 
shblth - :P - :D
 
7:12 PM
Tune in to Summer Games Done Quick to watch a robot play video games.
 
DSM
7:44 PM
Mid-Saturday afternoon hacking time!
 
Hey up
 
DSM
How are things across the pond?
 
8:00 PM
Good. Start work on Monday so been packing my bag for my induction week. And how fares Canada?
 
Quick question
Does django project have to be inside the virtualenviroment folder?
 
DSM
Still unreasonably warm, at least my corner of it, but it rained yesterday which was a nice break. Looks like I'll be spending the next five or six weeks or so doing various science-y things (trying to reproduce the analyses in some papers from the raw data, and hopefully improve upon them), so that should be interesting.
 
user559633
@nope no
 
@tri
 
user559633
you're welcome!
 
8:04 PM
so it just have to be active django project can be located anywhere?
 
user559633
@nope not sure what "active" means. you just need django installed and in your pythonpath
 
I am using Koding
 
user559633
I don't know what that is, but this is turning into a winding "quick question" :)
 
Thank you for your help
 
user559633
No problem :) If your django install isn't working, it's because your python interpreter doesn't have the django module in its path.
 
8:08 PM
Oh and koding is cloud ide :)
django installed without problem Thanks tho :)
 
user559633
no problem! i didn't mean to be gruff -- environment setup questions usually require good amount of background information
 
DSM
Oops. For the second time in my SO career, I've just accidentally protected (and then unprotected) a question. Think I need to hire Kevin to write me a userscript which suppresses that link.
 
8:24 PM
Better than accidentally deleting a user though :)
 
Depends on the user.
 
That's true :)
 
9:06 PM
Good afternoon Pythonistas, what's going awesome? I just closed a ton of tabs while making a few annotations in my .bashrc! I'm productive!
Anyone ever do dot graphviz in orgmode? Got any fav resources?
 
Anybody experienced with virtualenv and uWSGI able to help me a bit with this: stackoverflow.com/questions/31754740/…?
I'm kinda going in circles trying to understand it
Don't worry, I read the rules, and yeah it's a day old, so I'm good :P
well, I guess i have to say rbrb :P
 
10:02 PM
ugh, argparse's "help and exit" seems to be an unsuppressable exit, annoying since when used for a command in a cmd.Cmd derived class, it exits the whole program -_-
 
 
1 hour later…
11:04 PM
Firing it off in it's own thread (my only need to import threading..) seems way overkill.. but is there any other way I can prevent a library function from exiting the program with sys.exit()?
 
DSM
There's del sys.exit, but I suspect that's not what you had in mind. ;-)
 
@OllieFord sounds like the makings of a good question, interested to know the answer to this
 
@DSM Heh. I'm actually hoping to make it less hacky...
 
DSM
Is there some reason you can't just catch a SystemExit?
 
@DSM Because I'm an idiot and didn't think of that?
:p Cheers!
 

« first day (1750 days earlier)      last day (3181 days later) »