[issue16837] Number ABC can be instantiated

2019-08-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2019-08-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let's not do this. We've survived this long.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2019-08-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I looked into this a bit more and don't see another non-invasive way of 
blocking instantiation.

Marking for Guido to take a look at.  He's the expert on ABCs and typing and is 
the originator of the __hash__ = None approach to turning off hashability.

Guido, would you like number subclasses to require an override of __hash__ or 
is the accidental instantiation of Number() something we even care about (I 
think this unlikely to ever arise in practice)?  My suggestion is to deem it 
harmless and leave it as is.

--
assignee: rhettinger -> gvanrossum
nosy: +gvanrossum
versions: +Python 2.7 -Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2019-08-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Usually, setting hash to None is the proper way to turn-off hashability.  And 
it's possible that existing code has subclassed Number and provided other 
methods but not __hash__, so this could potentially break their code.  On the 
other hand, it would be desirable to prevent instantiation, perhaps using some 
other mechanism would be better.  I'll take a deeper look at this when I get a 
chance.

--
assignee:  -> rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2019-08-09 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

I'm changing the versions to Python 3.8 and 3.9 for this bug.

--
versions: +Python 3.8, Python 3.9 -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2019-08-09 Thread Sanyam Khurana


Sanyam Khurana  added the comment:

Hi Alexander,

Can you please address the reviews and turn this patch into a GitHub PR, please?

--
nosy: +CuriousLearner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2014-12-04 Thread Berker Peksag

Berker Peksag added the comment:

I left a couple of comments on Rietveld.

--
nosy: +berker.peksag

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16837
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2014-09-27 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
components: +Library (Lib)
versions: +Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16837
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2014-09-27 Thread Claudiu Popa

Claudiu Popa added the comment:

I'd say that this should be fixed, it breaks the expectancy imposed by the 
documentation, so +1 from me.

--
nosy: +Claudiu.Popa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16837
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2013-01-02 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Attached patch fixes the issue and passes regression tests, so most likely the 
ability to instantiate Number is not an intentional feature.

pass should probably be replaced with a meaningful docstring, but I would 
like to hear from others on whether the solution is conceptually correct before 
making it commit-ready.

--
keywords: +patch
nosy: +eric.araujo, ncoghlan, rhettinger
stage:  - patch review
Added file: http://bugs.python.org/file28531/issue16837.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16837
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16837] Number ABC can be instantiated

2013-01-01 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

According to the reference manual, None of the types defined in [numbers] 
module can be instantiated.  However,

 from numbers import *
 Number()
numbers.Number object at 0x1005e5080

This can probably be fixed by making Number.__hash__ an abstract method.

--
messages: 178785
nosy: belopolsky
priority: normal
severity: normal
status: open
title: Number ABC can be instantiated
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16837
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com