[Baypiggies] Baypiggies snippets

Doug Landauer zia at cruzio.com
Thu Mar 22 07:07:12 CET 2007


On Mar 21, 2007, at 8:22 PM, Keith Dart ♂ wrote:
> It's so general, I think it should be a built-in function and not in a
> GUI toolkit.

For what it's worth, Ruby's Array class has just such a "flatten" 
method.

> Speaking of that, how do people here feel about inserting general
> purpose functions like that into the __builtin__ namespace?

This sure seems more like it oughta be a method, which displays either 
a flaw
in Python's general duck-typing philosophy or a gap in my understanding
(possibly polluted by a couple years' worth of Ruby programming):

If we have come across the need/desire for a new general method that
should work just fine with anything that "quacks like a sequence", and
we would like to make it available to any sequence in any of our Python
code, and I want to invoke it as foo.method for any foo that is
a sequence, then where/how would I define such a method?

     -- Just curious,
     -- Doug L.



More information about the Baypiggies mailing list