[issue21444] __len__ can't return big numbers

2020-01-10 Thread Zac Hatfield-Dodds


Change by Zac Hatfield-Dodds :


--
pull_requests: +17341
pull_request: https://github.com/python/cpython/pull/17934

___
Python tracker 

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



[issue21444] __len__ can't return big numbers

2014-05-08 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I recommend this be closed:  too much impact on existing code for too little 
benefit.  

CPython has historically imposed some artificial implementation specific 
details in order make the implementation cleaner and faster internally (i.e. a 
limit on the number of function arguments, sys.maxsize limits, etc.)

--
nosy: +rhettinger
priority: normal - low
type:  - enhancement
versions: +Python 3.5 -Python 3.4

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



[issue21444] __len__ can't return big numbers

2014-05-08 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - wont fix
status: open - closed

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue21444] __len__

2014-05-06 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
title: __len__ can't return big numbers - __len__

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
title: __len__ - __len__ can't return big numbers

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

Whoops; sorry -- accidental title change by typing `__len__` into something 
that wasn't the search box.

Stupid fingers...

(I suspect this issue is a duplicate of an existing issue.)

--
nosy: +mark.dickinson

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread R. David Murray

R. David Murray added the comment:

Mark: I thought it was too, but the two I noted were the closest I could find.  
Maybe you'll find something even more on point :)

--

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread akira

akira added the comment:

If `len()` signature can't be changed to return Python int objects (unlimited) 
then the OverflowError may contain the actual `.length`
 property instead (based on msg66459 by Antoine Pitrou)

operator.length():

def length(sized):
Return the true (possibly large) length of `sized` object.

It is equivalent to len(sized) if len doesn't raise 
OverflowError i.e., if the length is less than sys.maxsize on
CPython; otherwise return OverflowError.length attribute

try:
return len(sized)
except OverflowError as e:
return e.length

--
nosy: +akira

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



[issue21444] __len__ can't return big numbers

2014-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

That's pretty evil. :-)

--

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



[issue21444] __len__ can't return big numbers

2014-05-05 Thread Ram Rachum

New submission from Ram Rachum:

I want to use big numbers for length.

 class A:
... __len__ = lambda self: 10 ** 20
 len(A())
Traceback (most recent call last):
  File pyshell#5, line 1, in module
len(A())
OverflowError: cannot fit 'int' into an index-sized integer

--
components: Interpreter Core
messages: 217957
nosy: cool-RR
priority: normal
severity: normal
status: open
title: __len__ can't return big numbers
versions: Python 3.4

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



[issue21444] __len__ can't return big numbers

2014-05-05 Thread R. David Murray

R. David Murray added the comment:

While this is classed as a CPython implementation detail (see issue 15718) it 
doesn't sound like it is likely to be changed (see issue 2723).

--
nosy: +r.david.murray

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