Importing variables non-deterministic?

Ben Finney ben+python at benfinney.id.au
Mon Aug 19 21:14:49 EDT 2013


Antoon Pardon <antoon.pardon at rece.vub.ac.be> writes:

> Op 19-08-13 09:45, Dave Angel schreef:
> > Antoon Pardon wrote:
> >> I think you are overstating your case. Classes and functions are
> >> variables too and in general nobody seems to have a problem with
> >> them being global.
> > 
> > It's global *variables* that are to be avoided. constants like
> > clsases and functions are fine. On the other hand, class attributes
> > can be variable, and thus are to be avoided when reasonable.
>
> Python has no constants. Classes and functions can be changed just like
> any other variable. I agree that classes and function are generally
> meant to be constant, but often enought so are global int variables.

I take this as yet another data point that speaking about “variables”
leads mostly to confusion.

What Python has are bindings. Those bindings can change (what Antoon
calls “changed just like any other variable”).

Many objects are immutable (what Dave calls “constants like classes and
functions”), even if the bindings can vary and even if they contain
attributes which are themselves bindings that can change.

So, you're both right. The terminology is leading you both astray and
having you talk past each other. Now go forth and speak of variables no
more :-)

-- 
 \         “We demand rigidly defined areas of doubt and uncertainty!” |
  `\    —Vroomfondel, _The Hitch-Hiker's Guide To The Galaxy_, Douglas |
_o__)                                                            Adams |
Ben Finney




More information about the Python-list mailing list