strong/weak - dynamic/static [Was: Getting started]

Alex Martelli aleax at aleax.it
Thu Sep 19 18:41:04 CEST 2002


On Thursday 19 September 2002 05:51 pm, sismex01 at hebmex.com wrote:

[snip: my code showing how an object can dynamically change type]

> > If you find a way to name this behavior "static", you'll be well
> > placed for the yearly Humpty Dumpty award.
	...
> Maybe you're being a bit rash, Alex?

Maybe, and maybe not.

[snip: sixmex01's code showing how not ALL dynamic type changes are allowed]

> The behaviour you expounded does not blindly work, it seems.

Of course, and, had I claimed Python is "BLINDLY dynamic", then I'd have
been "a bit rash".  As I cleverly omitted the damning adverb, I'm safe.

An object's type can be changed at runtime *as long as* this doesn't
alter the "layout" (__slots__ isn't the only example: you can't, for example,
dynamically change the type of a list to be a dictionary, etc, etc).

This still leaves Python vastly more dynamic than the great majority of
languages, where an object's type is determined, at the latest, at
object-creation time.  (SOME languages may indeed be even slightly
more dynamic: I think Ruby is, for example; but the fact that SOME
F1 drivers are even faster than Mr Barrichello -- one Mr Shumaker
comes to mind -- hardly means one is "being a bit rash" if one deems
Mr Barrichello a deucedly fast driver indeed).


Alex




More information about the Python-list mailing list