learning python ...

Dan Stromberg drsalists at gmail.com
Mon May 24 19:27:08 EDT 2021


On Sun, May 23, 2021 at 12:35 PM hw <hw at adminart.net> wrote:

> I don't know about shadowing.  If I have defeated a whole variable type
> by naming a variable like a variable type, I would think it is a bad
> idea for python to allow this without warning.  It seems like a recipie
> for creating chaos.
>

It strikes me as a pretty natural consequence of types being first class
objects in Python.  There's a little unlearning to do if you're coming from
a more traditional language, but it's not difficult once you know how
Python does its thing.

Have you ever tried to put int (not an int, the type int) in a variable in
C?  You can sort of do it with the C PreProcessor, but that's always been a
bit of a kludge.

IOW, in Python everything is an object.


More information about the Python-list mailing list