__call__ considered harmful or indispensable?

Paul Rubin http
Thu Aug 2 22:56:23 CEST 2007

Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> writes:
> from foo import foo
> x = foo(3)
> Or did I miss the point ???

The foo module might define a bunch of additional functions that you
still want to be able to access in qualified form.  For example it
would somewhat clean up the interface to the python random module if
you could say

  import random
  x = random()   # get a random float between 0 and 1
while still having access to random.shuffle, random.choice, etc.

More information about the Python-list mailing list