A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-November/029922.html below:

[Python-Dev] metaclass insanity

[Python-Dev] metaclass insanityGuido van Rossum guido@python.org
Tue, 05 Nov 2002 12:00:45 -0500
> Keeping a definition of some X (whether X is a class, a function,
> whatever) as local as feasible has one obvious merit which I have
> already pointed out: a reader of the code need NOT ask himself
> "where is this X defined" when X is used, nor "how is this X used"
> when X is defined -- the answers become immediately obvious by the
> very way the code is structure... X is defined right here and used
> right here.

Yes.  However this is counterbalanced by the distraction for the
reader though when the details of X's implementation make it even a
moderately large lump of code (above a couple of lines); usually these
details aren't of immediate interest to the reader where X is used.

> > I also think that it's better that the iterator class *is*
> > accessible to the user -- that way you can do an isinstance()
> > check for it, for example.
> 
> To me, that's a good reason to AVOID making the class directly
> accessible to the user.  I find that most uses that programmers
> make of type-testing in Python (e.g. with isinstance) are more
> damaging than helpful; anything that happens to discourage such
> damaging practices therefore looks good to me thereby.

So use a name starting with an underscore.  That's enough of a hint.

> In my experience so far, I find that wrapper classes tend to
> be rather small -- maybe that comes from my general style.

Wrapper classes are just one example of helper classes.  The argument
for keeping helper classes out of the way applies broadly.

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4