Reputation
Top tag
Next privilege 125 Rep.
Vote down
Badges
4
Impact
~1k people reached

  • 0 posts edited
  • 0 helpful flags
  • 32 votes cast
Sep
24
awarded  Autobiographer
Nov
5
comment Is it bad style to redundantly check a condition?
@mcwise: yes, in Python they are not needed and add zero information (but note that they are ok in a multi-line condition).
Nov
5
comment Is it bad style to redundantly check a condition?
+1 for pointing out that the (unnecessary) imperative implementation of clear_lines is really a bad idea. In Python you would probably use generators to avoid loading the complete file in memory.
Nov
5
comment Is it bad style to redundantly check a condition?
did you mean elif (line.startsWith("b"))? by the way, you may safely remove those surrouding parenthesis on the conditions, they are not idiomatic in Python.
Nov
2
awarded  Teacher
Oct
20
comment Is it okay to define a [] method in ruby's NilClass?
@Jamon: of course, but the difference is you're being explicit by using "maybe". When you know the hash has those keys, you would simply write h[k1][k2][k3], if you patch NilClass you get always the "promiscous" behavior, you have zero choice.
Oct
19
comment Is it okay to define a [] method in ruby's NilClass?
@JamonHolmgren: Well, yeah, it's a matter of taste, h.maybe[k1].maybe[k2] vs h && h[k1] && h[k1][k2]. The first looks more declarative to me. On the downsides, yeah, the one you mention is probably the more important, a library may depending on a NoMethod exception being raised in that situation. IMO it would also lead to buggy code, it may shadow problems (i.e. I miswrite a key but no exception is raised).
Oct
19
revised Is it okay to define a [] method in ruby's NilClass?
added 90 characters in body
Oct
19
awarded  Editor
Oct
19
revised Is it okay to define a [] method in ruby's NilClass?
added 90 characters in body
Oct
19
answered Is it okay to define a [] method in ruby's NilClass?
Aug
1
comment Why can't the IT industry deliver large, faultless projects quickly as in other industries?
+1 Thanks for the insight. "to design if you know know how things work" -> " to design if you don't know how things work" ?
Aug
1
comment Why can't the IT industry deliver large, faultless projects quickly as in other industries?
@pkh: well seen, Reeves proposed that "code as design" idea 24 years ago!
Dec
20
comment Is using ELSE bad programming?
as a side note: if you have an if construct in your pure functional language, then you really need to have an else. Every expression has to return something!
Dec
14
awarded  Supporter