chrome/ff dev tools have source maps support, I can work directly with coffee source the same way, as I work with less source instead of compiled css ... only coffeeconsole is in a separate tab via chrome extension
+1, CS can be learned in few hours and any questions on what each constuct produces can be quickly resolved in coffeeconsole for chrome
Verification: lead development of 50MD and 300MD mobile html5 apps for major UK TV's and even people who did see CS first time were able to pick it up quickly. I had literally about 5 cases when I had to answer some chat questions on how CS works, and about the same count when I corrected/optimized some CS usage in a code review.
The productivity gain was impressive. In ducktyping, but esp. in __understanding__ the code quickly.
Good coverage. I use it quite often for cache dictionary, it's much simpler API and overall code, than creatng a new class for it. Demo snippet from effbot's site:
def calculate(a, b, c, memo={}):
try:
value = memo[a, b, c] # return already calculated value
except KeyError:
value = heavy_calculation(a, b, c)
memo[a, b, c] = value # update the memo dictionary
return value
The other option is to create your own cache object and pass that in (and around, if it's a recursive function). Of course, in Python pretty much every cache object follows the dictionary interface anyway, so it doesn't really matter. One of the benefits of duck typing :)
Because that "if" is a statement whereas the ternary expression is, well, an expression. There are places expressions can be used that statements can't (eg lambdas) and that x or [] won't work (eg when x is False).
That said, people still seem to favor your form as the more Pythonic way. Personally, I think that's just because the ternary expression is relatively new.