but get_fields_by_name sounds like good place to
start.
W dniu poniedziałek, 24 lutego 2014 09:43:43 UTC+1 użytkownik Adam Kaliński
napisał:
>
> Good tips. Thanks! I'll improve them and post as soon as they're ready.
> Moreover I was thinking that it might be nice to just m
x27;).timeit()
>>> 0.3240630626678467
>>>
>>> # namedtuple with indices
>>> >>> Timer('t[0], t[1], t[2], t[3], t[4]', setup='''
>>> from collections import namedtuple
>>> T = namedtuple("T", "a b c
Oh! And as far as I understand they're equally memory consuming
import sys
from collections import namedtuple
T = namedtuple('T', 'a b c d e')
assert sys.getsizeof((1,2,3,4,5)) == sys.getsizeof(T(1,2,3,4,5))
W dniu niedziela, 23 lutego 2014 14:12:38 UTC+1 użytkown
wdown is on a namedtuple's creation.
> I imagine the impact would be negligible on a complete request-response
> cycle, but that would have to be tested.
>
> Accessing a namedtuple's items using attributes is also somewhat slower,
> but this wouldn't be a problem. Exi
u know any :).
The get_field_by_name is probably not the only place where they could be
used.
What do you guys think?
Regards,
Adam Kaliński
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and s