FEEDBACK WANTED: Type/class unification

Terry Reedy tjreedy at home.com
Wed Aug 22 20:07:49 EDT 2001


"Hamish Lawson" <hamish_lawson at yahoo.co.uk> wrote in message
news:915a998f.0108220858.3f062acd at posting.google.com...
> While on this subject, would it be an idea to make built-in types
> callable, so that you just call an object without caring whether it
> was a function/method or a simple type?

Yes it would be an idea.  Why would you want such?
Would it be useful? or would it encourage bad programming?, that is
the question.

> Thus:
> x = 10
> def y():  return 10
> x()
> y()

I presume you are proposing a default "def __call__(self): return
self" for all objects.
Note that tacking parens on literals would violate current Python
syntax: ie,
10(), 'ab'(), [1,2,3](), etc are currently seen as errors.  *All*
other methods are accessed through '.method' notation, which is legal
for literals.

Terry J. Reedy






More information about the Python-list mailing list