Life's better without braces

Moshe Zadka moshez at
Fri Feb 25 15:48:07 EST 2000

On Fri, 25 Feb 2000, Gerrit Holl wrote:

> def callable(f):
>     try:
>         f()
>         return 1
>     except TypeError:
>         return 0
> Hmm, this is wrong.

To emphasize Gerrit's point:

def f():
	raise TypeError()

> What about checkins if... no, I don't know.

I doubt it's possible.

> > ord should also be possible.
> Possible with some dictionairy.

Hey, we can always right a Python program to write a Pythonic huge
if statement:

>>> def his():
...     print "def ord(c):"
...     print "\tif type(c) is not type('') or len(c)!=1:"
...     print "\t\traise TypeError('too lazy')"
...     for i in range(256):
...             print "\tif c=='\\x%x': return %d" % (i, i)
...     print "\traise TypeError('this is impossible')"

(I was merciful enough to include the output)
Moshe Zadka <mzadka at>. 
INTERNET: Learn what you know.
Share what you don't.

More information about the Python-list mailing list