anomaly

zipher dreamingforward at gmail.com
Tue May 12 23:39:46 EDT 2015


On Tuesday, May 12, 2015 at 10:43:44 AM UTC-5, Chris Angelico wrote:
> On Wed, May 13, 2015 at 1:34 AM, zipher <dreamingforward at gmail.com> wrote:
> > Name one "significant and important" use case for shadowing built-in types.  Functions, I don't have a problem with, but types are more fundamental than functions.
>
> Please tell me what, precisely, is the difference between a type and a
> function.

A type is something that settles matters for the machine.  A function calculates on the machine.  You can have a type without a function, but you generally can't have a function without types.  If a distorted example like function f(): {} has an implicit return of an int in ANSI C.

> Once you've settled that, please explain to me what the
> built-in name 'int' is in all versions of Python.

'int' is a type that also has a function synonymous with it.  But they should not be considered the same.  They could, for example, be decoupled.  So that 'int' was the type and 'integer' was the function.

Mark



> ChrisA




More information about the Python-list mailing list