Favorite non-python language trick?

GodFoca godfoca at gmail.com
Mon Jun 27 20:22:35 CEST 2005

> if a.value == True:
>     return a

> if not database.connect == error:
>     database.query(q)

Yeah, yeah, I know that :-)
What I mean is that most of the time I find the code more "readable" (I
know that more readable code ain't better code, but it helps when you
work with other people...).

> "unless" seems to become "while not", as opposed to "if not". Should be
> more consistent.

My mistake :-S
The comment in the code was erroneous, I shouldn't write messages to
the list while asleep ^_^

'unless' works as 'if not', not as 'while not'. Sorry for that :-)

Anyway, it does improve readability. I know that it doesn't necessarily
makes code better, but it's a nice "trick" that I like :-)

Other nice thing about ruby is declaring regexps as /regexp/ rather
than having to re.compile("regexp"), and having a built-in operator to
match against them (of course, as everything in ruby, overloadable in
each class :-))


More information about the Python-list mailing list