Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32419
| References | <CAF_E5Jbf0KJjDLV0jS-p_J9E4D8=_sPScgE+vkmkN2sMw=3aoA@mail.gmail.com> <1793477354.3492917.1351526431192.JavaMail.root@sequans.com> <CAF_E5JYRWxChJMHZc62d74Xnw88S2FhcXqot2V0hPuxfgbzbuw@mail.gmail.com> <CALwzidmjXz4JuYRCkWtXtHtDcv7DLzFjfUUxWuopwafmTHoP-g@mail.gmail.com> |
|---|---|
| Date | 2012-10-30 06:36 +1100 |
| Subject | Re: Immutability and Python |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3044.1351539415.27098.python-list@python.org> (permalink) |
On Tue, Oct 30, 2012 at 6:23 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> _MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2
> field3 field4')
>
> class MyImmutableClass(_MyImmutableClass):
Question: Is it clearer to take advantage of the fact that the base
class can be an arbitrary expression?
class MyImmutableClass(namedtuple('MyImmutableClass', 'field1 field2
field3 field4')):
You lose the unnecessary temporary and triplication of name, but gain
instead a rather long line.
ChrisA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Immutability and Python Chris Angelico <rosuav@gmail.com> - 2012-10-30 06:36 +1100 Re: Immutability and Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-29 22:34 +0000
csiph-web