En Tue, 19 Aug 2008 12:43:27 -0300, eliben <[EMAIL PROTECTED]> escribió:
On Aug 18, 11:16 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
On 13 ago, 14:46, eliben <[EMAIL PROTECTED]> wrote:
> On Aug 13, 7:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> > Try named tuplehttp://code.active
eliben wrote:
Whaaa? Named tuples are being added to Python? Neat! Is there any
documentation on this? I can't seem to find anything on the web...
It's not easy to find unless you recall where you've seen it:
http://docs.python.org/dev/3.0/library/collections.html#collections.namedtuple
Thank
On Aug 21, 4:51 am, Dave Benjamin <[EMAIL PROTECTED]> wrote:
> Christian Heimes wrote:
> > eliben wrote:
> >> Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
> >> does this. I suppose it can be done with 'exec', but is there a more
> >> Pythonic way ?
>
> > Try named tuplehttp:
Christian Heimes wrote:
eliben wrote:
Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
does this. I suppose it can be done with 'exec', but is there a more
Pythonic way ?
Try named tuple http://code.activestate.com/recipes/500261/
A named tuple implementation is part of Py
En Wed, 20 Aug 2008 04:00:08 -0300, Dan Lenski <[EMAIL PROTECTED]>
escribi�:
On Mon, 18 Aug 2008 08:28:53 -0700, Dan Lenski wrote:
So is there a bug in the Python docs? Does __slots__ in fact work with
subclasses of tuple?
Anybody think that this may actually be a mistake in the Python doc
On Mon, 18 Aug 2008 08:28:53 -0700, Dan Lenski wrote:
> So is there a bug in the Python docs? Does __slots__ in fact work with
> subclasses of tuple?
>
> Dan
Anybody think that this may actually be a mistake in the Python docs? Who
would I contact about getting them corrected?
Dan
--
http://
On Aug 18, 11:16 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> On 13 ago, 14:46, eliben <[EMAIL PROTECTED]> wrote:
>
> > On Aug 13, 7:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
>
> > > eliben wrote:
> > > > Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
> > > > do
On Aug 13, 1:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> Trynamedtuplehttp://code.activestate.com/recipes/500261/
>
> Anamedtupleimplementation is part of Python 2.6 and 3.0. For older
> versions of Python use the recipe from activestate.
>
> Christian
This named tuple recipe is pretty co
On 13 ago, 14:46, eliben <[EMAIL PROTECTED]> wrote:
> On Aug 13, 7:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
>
> > eliben wrote:
> > > Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
> > > does this. I suppose it can be done with 'exec', but is there a more
> > > Pytho
On Thu 14 Aug 2008 11:19:06 AM EDT, Larry Bates wrote:
> eliben wrote:
>> Hello,
>>
>> I want to be able to do something like this:
>>
>> Employee = Struct(name, salary)
>>
>> And then:
>>
>> john = Employee('john doe', 34000)
>> print john.salary
I find something like this useful, especially
eliben wrote:
Hello,
I want to be able to do something like this:
Employee = Struct(name, salary)
And then:
john = Employee('john doe', 34000)
print john.salary
Basically, Employee = Struct(name, salary) should be equivalent to:
class Employee(object):
def __init__(self, name, salary):
eliben <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I want to be able to do something like this:
>
> Employee = Struct(name, salary)
>
> And then:
>
> john = Employee('john doe', 34000)
> print john.salary
>
> Basically, Employee = Struct(name, salary) should be equivalent to:
>
> class Employee(o
On Aug 13, 7:30 pm, Christian Heimes <[EMAIL PROTECTED]> wrote:
> eliben wrote:
> > Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
> > does this. I suppose it can be done with 'exec', but is there a more
> > Pythonic way ?
>
> Try named tuplehttp://code.activestate.com/recipes
eliben wrote:
Ruby's 'Scruct' class (http://ruby-doc.org/core/classes/Struct.html)
does this. I suppose it can be done with 'exec', but is there a more
Pythonic way ?
Try named tuple http://code.activestate.com/recipes/500261/
A named tuple implementation is part of Python 2.6 and 3.0. For ol
On Aug 13, 6:43 pm, eliben <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I want to be able to do something like this:
>
> Employee = Struct(name, salary)
>
> And then:
>
> john = Employee('john doe', 34000)
> print john.salary
>
> Basically, Employee = Struct(name, salary) should be equivalent to:
>
> cl
15 matches
Mail list logo