Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10490

Re: NoneType and new instances

From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: NoneType and new instances
References <mailman.1575.1311866659.1164.python-list@python.org> <87hb66nkn5.fsf@benfinney.id.au> <mailman.1597.1311891054.1164.python-list@python.org>
Date 2011-07-29 09:52 +1000
Message-ID <878vrinesv.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


Ethan Furman <ethan@stoneleaf.us> writes:

> Ben Finney wrote:
> > Ethan Furman <ethan@stoneleaf.us> writes:
> >> This feels like a violation of 'Special cases aren't special enough
> >> to break the rules.'
> >
> > In the case of ‘bool’, the rule was broken before being introduced.
>
> I think we disagree on what the rule is.  I see it as "Return an instance
> if you can."

That's not the rule for singletons, though. You've already said what the
rule is:

> Nobody has yet pointed out a good reason on why NoneType,
> NotImplementedType, and ellipsis (to be thorough ;) cannot or should
> not return the single instance that exists

So we agree on what the rule is. The ‘bool’ type breaks that rule, for
the reasons given earlier.

You may want to advocate for a *change* to that rule, or what the rule
*should be*, but that's a different issue.

> when every other built-in will return either a new object, or the
> single object that exists for that value.

What other built-in singleton types are there?

-- 
 \                    “It's all in the mind, you know.” —The Goon Show |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

NoneType and new instances Ethan Furman <ethan@stoneleaf.us> - 2011-07-28 08:39 -0700
  Re: NoneType and new instances Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-28 11:34 -0400
  Re: NoneType and new instances Ben Finney <ben+python@benfinney.id.au> - 2011-07-29 07:46 +1000
    Re: NoneType and new instances Ethan Furman <ethan@stoneleaf.us> - 2011-07-28 15:26 -0700
      Re: NoneType and new instances Ben Finney <ben+python@benfinney.id.au> - 2011-07-29 09:52 +1000
  Re: NoneType and new instances Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-29 11:16 +1000
    Re: NoneType and new instances Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-30 14:50 +1200
      Re: NoneType and new instances Terry Reedy <tjreedy@udel.edu> - 2011-07-30 09:35 -0400
      Re: NoneType and new instances python@bdurham.com - 2011-07-30 11:43 -0400
  Re: NoneType and new instances "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-07-30 09:39 -0700
    Re: NoneType and new instances Terry Reedy <tjreedy@udel.edu> - 2011-07-30 23:34 -0400
      Re: NoneType and new instances Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-31 14:28 +1000

csiph-web