magic names in python

Marc 'BlackJack' Rintsch bj_666 at
Tue Jun 5 10:03:13 CEST 2007

In <1181027654.070887.10910 at>, per9000 wrote:

> Still, I have problems with "magic" functions, similar to magic
> numbers:
> f.x. calling all member-functions of a class to close files as
> illustrated in a previous post, or PyUnits magic "test*"-names:
> (there are
> options here but I fell into the bear-trap of course)

I don't see much similarity here.  While magic numbers are quite
meaningless on their own, the name prefix carries at least *some*
explanation and therefore is much less magic.  Maybe not even magic at all
in the sense of the Wikipedia article.

> Guessing from your replies this is a general problem/issue/feature and
> as I understand it there is no special pythonic recommendations in
> this area, right?

Except documenting what's going on and not over(ab)using the reflective
and dynamic nature of Python to the point where the source starts to get
unreadable and too magic, AFAIK there's no special "pythonic"
recommendation.  :-)

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list