Remember driver's ed? I barely do. I don't remember how far before a railroad crossing I'm supposed to stop, or how far away from an intersection I have to be to change lanes. Probably the only thing I took away from it, the one mantra repeated over and over, is to slow downRaining? Slow down. Low on gas? Slow down. Bumpy road? Slow down.
(
Read more... )
Comments 8
This python @funcs.append shit baffles me. Then again, Python baffles me; in Ruby we'd phrase this as
irb0> x = [lambda do
irb2* "hello"
irb2> end
irb1> ]
⇒ [#
]
irb0> x[0].call()
⇒ "hello"
Reply
Ruby requires an end dangling on every single block to allow anon syntax that's pretty darn ugly anyway. Python removes the noise and just doesn't support the ugly. 8) I am okay with this.
edit: Wait, .call()? Are you serious?
Reply
The dangling end is a little annoying, but let's just think of it as a discouragement from nesting too deeply, shall we? Also, it isn't for the anon syntax specifically, it's for the yield/block thing.
I never got into python's decorator syntax, so, yeah.
Reply
Decorators are way easier than anyone makes them out to be. This:
@exp def foo(): ...
is equivalent to:
def foo(): ...
foo = exp(foo)
And that is exactly all they do.
(So you will actually end up with foo == None in my code, because .append() doesn't return anything.)
Reply
Reply
Reply
Leave a comment