Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
webexcess
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
webexcess
14y ago
Yes, your code is the same as the first example generator with a single yield in a loop. The same conversion for the later examples with multiple yield statements, try: except: or try: finally: will be much hairier, though.
2.
▲
by
webexcess
14y ago
I stole that from here http://meyerweb.com/eric/css/edge/complexspiral/glassy.html
3.
▲
by
webexcess
14y ago
Thank you, I hadn't seen that. I've added that link to the bottom of my article.
4.
▲
by
webexcess
14y ago
That's a feature! Seriously though, not being able to define a serialization method can be a limitation. However, it is always possible to turn a generator into an iterator class with whatever methods you like, but the code may end up look
5.
▲
Python Generators in Depth
(excess.org)
171 points
by
webexcess
14y ago
|
26 comments
6.
▲
Python Iterables, Iterators and Generators (part 1)
(excess.org)
2 points
by
webexcess
14y ago
|
0 comments
7.
▲
by
webexcess
15y ago
It should be possible to create the exact same classes dynamically, without using exec. The only advantage I can see of the exec is that the class template string makes it a little clearer what the equivalent "normal" class definition woul
8.
▲
by
webexcess
15y ago
You can use python -i to enter interactive mode after executing a script. Maybe I should clarify that part
9.
▲
by
webexcess
15y ago
Good point. I didn't address this adequately. The usual #python response to people using the array module was to instead consider NumPy (with its excellent arrays) or use normal lists and PyPy to make it fast.
10.
▲
Unfortunate Python
(excess.org)
194 points
by
webexcess
15y ago
|
55 comments
11.
▲
Urwid 1.0: python 3 support, terminal widget, pop-ups, tree views and more
(excess.org)
2 points
by
webexcess
15y ago
|
0 comments
12.
▲
Django Widgets, Form Fields and Model Fields Explained
(excess.org)
2 points
by
webexcess
15y ago
|
0 comments
13.
▲
Moving to Python 3
(lwn.net)
2 points
by
webexcess
16y ago
|
0 comments