[Python-3000] gettype

tomer filiba tomerfiliba at gmail.com
Thu Jul 6 20:19:05 CEST 2006


as you may remember, i suggest some time ago to distinguish
between the *function* type that returns the type of an object,
and *metaclass* type that creates new types. the main issue
was type() behaving both as a function and as a factory, which
is an overloaded behavior.

if i recall correctly, the general spirit was pro-disambiguation, and
the argument turned around the semantics of the change.
i suggested calling the function "typeof", and keeping the
metaclass in tact, but GvR didn't like the "%sof()" notation, as
it's quite unprecidented in the language.

so why not choose the "get%s()" notation? we already have
getattr, and other __get%s__ special methods, so gettype()
would perfectly fit into this convention. it also feels more
natural imo:

>>> type("blah", (), {})
<class '__main__.blah'>

>>> gettype(5)
<type 'int'>

link to the old discussion (including the full details for the
suggested change):
http://mail.python.org/pipermail/python-3000/2006-May/002224.html

any more comments? a pronouncement maybe?


-tomer


More information about the Python-3000 mailing list