[Chicago] History of programming

kirby urner kirby.urner at gmail.com
Wed May 27 07:17:04 CEST 2015


>
>
> Python has a clear notion of "callable" as "those objects which eat" i.e.
> "have a mouth" (how I start with beginners sometimes).
>
> Our callables aren't just functions, but types as well.   In Python 3.x,
> range() and enumerate() are type calls, not function calls.
>

Of course a function is just another type e.g. FunctionType or <class
'function'>.

So in another sense callables are all types as everything is an object and
all objects have type.

Just next( ) and iter( ) are more the builtin functions whereas we also
have a more general type object of type type.

>>> type (int)
<class 'type'>
>>> type (str)
<class 'type'>
>>> def F(): pass
>>> type(F)
<class 'function'>

(using 3.4)

Kirby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20150526/aa9cb405/attachment.html>


More information about the Chicago mailing list