Named tuples

Carlos Ribeiro carribeiro at gmail.com
Thu Nov 18 15:28:47 CET 2004


On Thu, 18 Nov 2004 14:21:58 GMT, Bryan <belred1 at yahoo.com> wrote:
> Carlos Ribeiro wrote:
> > I think that a better way to solve the problem is to create a names
> > method on the tuple itself:
> > 
> > return ('1', '2').names('ONE', 'TWO')
> >
> > It's shorter and clean, and avoids a potential argument against named
> > parameters for the tuple constructor -- none of the standard
> > contructors take named parameters to set extended behavior as far as I
> > know.
> >
> 
> but doesn't this feel more pythonic and more consistant?
> 
> return ('ONE':'1', 'TWO':'2')

The problem is that it involves changing the language, and at this
point, the idea is to devise a solution that *doesn't* need to change
the language. But it's a possibility for the future, after a simpler
version of the same basic feature is approved and implemented.


-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list