Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107666
| From | Random832 <random832@fastmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: def __init__(self): |
| Date | 2016-04-26 12:26 -0400 |
| Message-ID | <mailman.114.1461687970.32212.python-list@python.org> (permalink) |
| References | (2 earlier) <85eg9sn7qo.fsf@benfinney.id.au> <mailman.100.1461656092.32212.python-list@python.org> <87lh40pyik.fsf@elektro.pacujo.net> <571f9362$0$1602$c3e8da3$5496439d@news.astraweb.com> <1461687967.2507874.590200129.102244C8@webmail.messagingengine.com> |
On Tue, Apr 26, 2016, at 12:12, Steven D'Aprano wrote: > The obvious reason for overriding __new__ is to construct an immutable > instance. You have to override __new__, because by the time it returns > the > instance is immutable and you can no longer initialise it. Other than by subclassing an existing immutable type written in C, is it actually possible to define a truly-immutable (rather than contract-immutable) class in python? (Of course, subclassing immutable C types is the more obvious answer to when you have to override __new__).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
def __init__(self): San <santanu01@gmail.com> - 2016-04-25 23:21 -0700
Re: def __init__(self): Ben Finney <ben+python@benfinney.id.au> - 2016-04-26 16:31 +1000
Re: def __init__(self): Gary Herron <gherron@digipen.edu> - 2016-04-26 00:06 -0700
Re: def __init__(self): Ben Finney <ben+python@benfinney.id.au> - 2016-04-26 17:34 +1000
Re: def __init__(self): Marko Rauhamaa <marko@pacujo.net> - 2016-04-26 11:25 +0300
Re: def __init__(self): Steven D'Aprano <steve@pearwood.info> - 2016-04-27 02:12 +1000
Re: def __init__(self): Random832 <random832@fastmail.com> - 2016-04-26 12:26 -0400
Re: def __init__(self): Steven D'Aprano <steve@pearwood.info> - 2016-04-27 02:32 +1000
Re: def __init__(self): Chris Kaynor <ckaynor@zindagigames.com> - 2016-04-26 09:59 -0700
Re: def __init__(self): Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-27 14:54 +1000
Re: def __init__(self): Chris Angelico <rosuav@gmail.com> - 2016-04-27 03:04 +1000
Re: def __init__(self): Chris Kaynor <ckaynor@zindagigames.com> - 2016-04-26 10:13 -0700
Re: def __init__(self): Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 11:26 -0600
Re: def __init__(self): Chris Angelico <rosuav@gmail.com> - 2016-04-27 03:30 +1000
Re: def __init__(self): Marko Rauhamaa <marko@pacujo.net> - 2016-04-26 19:38 +0300
Re: def __init__(self): Random832 <random832@fastmail.com> - 2016-04-26 09:49 -0400
Re: def __init__(self): Gary Herron <gherron@digipen.edu> - 2016-04-26 07:25 -0700
csiph-web