[Python-3000] Generic function PEP won't make it in time

Talin talin at acm.org
Thu Apr 26 18:00:45 CEST 2007

Phillip J. Eby wrote:
> In particular, when you implement generic functions using generic 
> functions, it reads a lot like trying to explain the relationships between 
> "type" and "object" (i.e. type being its own type and an instance of 
> object, and object being a subclass of type).  You can say what needs to be 
> said in a fairly short space, but saying it in a way that lets people 
> actually wrap their heads around it takes a bit more text.  :)

I meant to comment on this earlier, and forgot.

I kind of wonder about the idea of implementing generic functions using 
generic functions. It's one of those ideas that is so obviously elegant 
and clever, that it's very easy for a programmer to fall in love with. 
As someone who frequently finds himself in a similar situation, I often 
discover later that the clever idea I loved wasn't the most practical.

I've occasionally been accused of being an "architecture astronaut", 
someone whose designs have a theoretical purity that is far above the 
heads of most of its users, to the point where it is hard for them to 
wrap their head around the design:


Related to this is my tendency towards "dual-duty design", in which 
every line of code is serving multiple agendas (like the way that all of 
the major components on an airplane serve more than one functions - the 
wings are not only the primary lift surfaces, they are also the fuel 
tanks and the mounting points for landing gear, engines, running lights, 
and so on.)

The advantage of this is that it makes the code very compact and dense, 
with lots of ideas being embodied in a relatively few lines of code.

The problem with this is that someone who comes along and reads my code 
may not be able to make any sense of it, especially if they are only 
aware of the primary agenda that is informing the code.

Now, I may be talking out of my butt here - I don't know much about your 
situation, or what rationales you have for designing things the way that 
you have. However, I would suggest that you might want to consider what 
your actual, practical needs are, and if there is a way to get them that 
is more straightforward and easy to explain.

-- Talin

More information about the Python-3000 mailing list