Do they belong to you? Claim these comments.
David Goodger
Is this you? Claim Profile »
6 months ago
in code-formatting people: I need your help on t+1
Breaking assignments over multiple lines: try to avoid backslashes. They're fragile and ugly. One space after the backslash will break it. Instead, I'd do:
cat1, cat2, cat3, cat4, cat5 = [
self.categories[x] for x in range(1, 6)]
IOW, use the properties of Python's brackets (and braces and parentheses).
As for conditional expressions, I hope you realize that these two dictionaries are almost identical:
{'selected':1 if self.preferred_send_method == x else None,
'disabled':1 if disabled else None,}
{'selected': self.preferred_send_method == x,
'disabled': disabled,}
Python's True == 1, and False == 0, so just use the condition directly as in the second version above. You used None as a false value; unless there's a good reason not to, you should use False instead.
cat1, cat2, cat3, cat4, cat5 = [
self.categories[x] for x in range(1, 6)]
IOW, use the properties of Python's brackets (and braces and parentheses).
As for conditional expressions, I hope you realize that these two dictionaries are almost identical:
{'selected':1 if self.preferred_send_method == x else None,
'disabled':1 if disabled else None,}
{'selected': self.preferred_send_method == x,
'disabled': disabled,}
Python's True == 1, and False == 0, so just use the condition directly as in the second version above. You used None as a false value; unless there's a good reason not to, you should use False instead.
- 2 points
- Jump to »
9 months ago
in Commentary on Python from a Java programming perspective on /var/log/mind
Welcome to Python!
You may be interested in a tutorial I gave in 2007 at PyCon and OSCON, "Code Like a Pythonista: Idiomatic Python". Full notes here: http://python.net/~goodger/projects/pycon/2007/...
You may be interested in a tutorial I gave in 2007 at PyCon and OSCON, "Code Like a Pythonista: Idiomatic Python". Full notes here: http://python.net/~goodger/projects/pycon/2007/...
- 2 points
- Jump to »
12 months ago
in Help improve my PyOhio talk on t+1
The way I deal with resolution differences is to use the Firefox "Web Developer" extension. It has a "Resize" feature where you can specify what size you want. Open a new window for your slides, make it full-screen (F11), resize to 1024x768, then reload the slideshow (ctrl-R). You'll get exactly what you'll see from the projector.
1 reply
Matt Wilson
Thanks David, I think I'll take that path.
1 year ago
in Help improve my PyOhio talk on t+1
"A fair number of code samples had the last few lines truncated."
Truncated vertically or horizontally? If vertically, put less code on the slides. If horizontally, wrap lines (fewer columns).
Slides have limited space. You just have to deal with it. And slides aren't the end-all of presentations. If they don't work for you, do something else (even just for part of your talk).
If you have a lot of code to show, switch to an editor. Turn the font size way up, and turn on auto-wrapping. In an editor, you have the freedom to scroll around, select text, correct typos & bugs, etc.
Truncated vertically or horizontally? If vertically, put less code on the slides. If horizontally, wrap lines (fewer columns).
Slides have limited space. You just have to deal with it. And slides aren't the end-all of presentations. If they don't work for you, do something else (even just for part of your talk).
If you have a lot of code to show, switch to an editor. Turn the font size way up, and turn on auto-wrapping. In an editor, you have the freedom to scroll around, select text, correct typos & bugs, etc.
1 reply
Matt Wilson
Hi David, That is an approach I considered, but I really like the simplicity of a single presentation format. Less can go wrong.
I could do the whole presentation just from a single really-long text file, I suppose....
I could do the whole presentation just from a single really-long text file, I suppose....
1 year ago
in Become a Master Designer: Rule Three: Contrast, Contrast, Contrast on GoMediaZine
I agree that contrast is important. But why do so many web pages (this one included) put their text in such a low contrast gray on an off-white background? I find it very hard to read.
Why not black (or a much darker gray) for the body text?
Why not black (or a much darker gray) for the body text?
I flip-flop a lot on using backslashes vs opening a list on one line
and then putting the meat of the assignments on the next line.
Thanks for the tip on conditional expressions. I'll go back and see
if that approach works. I prefer using None rather than False because
I'm never going to misinterpret None as an integer.
Thanks for the feedback.