[issue24663] ast.literal_eval does not handle empty set literals

2015-11-03 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: For now I'll implement my_literal_eval via AST filtering, reproducing ast.literal_eval + 'set()' functionality. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue24663] ast.literal_eval does not handle empty set literals

2015-11-03 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: I use communication protocol based on Python literals and ast.literal_eval for deserialization. I'm avoiding sets because empty set value is not supported in a clean consistent manner on language level. If I write repr(set()) i get 'set()', this should matter

[issue24663] ast.literal_eval does not handle empty set literals

2015-11-03 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: I believe this is the issue. ast.literal_eval sets support can not be considered complete until it also handles empty sets. I do not consider it valid for me to explicitly handle this case in my projects using some weird hacks. Python community settled

[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: IEEE & C/C++ standards allow and explicitly mention it, some people and projects are using it, many compilers preserve it... I believe it's reasonable to support it despite the fact it does not have standardized semantic meaning. Maybe one

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Reported issue was created in 64-bit Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32. Now I noticed that in Py 2.7 even copysign part does not work as expected. Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015

[issue26785] repr of -nan value should contain the sign

2016-04-16 Thread Hrvoje Abraham
New submission from Hrvoje Abraham: repr of -nan value should contain the sign so the round-trip could be assured. NaN value sign (bit) could be seen as not relevant or even uninterpretable information, but it is actually used in real-life situations, the fact substantiated by section 6.3

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32: >>> import struct >>> x=float("-nan") >>> struct.pack('<d', x) '\x00\x00\x00\x00\x00\x00\xf8\x7f' L

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Regarding NaN sign bit, IEEE-754 states: "Note, however, that operations on bit strings—copy, negate, abs, copySign—specify the sign bit of a NaN result, sometimes based upon the sign bit of a NaN operand. The logical predicate totalOrder is also aff

[issue26785] repr of -nan value should contain the sign

2016-04-17 Thread Hrvoje Abraham
Hrvoje Abraham added the comment: Sage: http://doc.sagemath.org/html/en/reference/rings_numerical/sage/rings/complex_number.html >>> log(ComplexNumber(NaN,1)) NaN - NaN*I -- ___ Python tracker <rep...@bugs.python.org> <http

[issue39335] round Decimal edge case

2020-01-14 Thread Hrvoje Abraham
New submission from Hrvoje Abraham : >>> from decimal import Decimal >>> round(Decimal('-123.49')) -124.0 I would expect -123.0, even considering Py2 rounding convention details (away from zero), Decimal rounding convention