[issue45347] datetime subject to rounding?

2021-10-03 Thread Joachim Jablon

Joachim Jablon  added the comment:

It may or it may not be obvious to some, but in year 5328, October 31st is the 
last Sunday of October, which in Rome, as in the rest of EU, according to the 
202X rules, means it’s the day we shift from summer time (in Rome UTC+2) to 
standard time (in Rome UTC+1). The shift supposedly happens at 3AM where it’s 
2AM, so not at midnight, but the proximity to a daylight shift moment raises 
some eyebrows. This could explain why it doesn’t happen on the year before or 
after. (I’m curious if it happens on year 5334 which has the same setup, but I 
cannot check at the moment)

--
nosy: +ewjoachim

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



[issue39550] isinstance accepts subtypes of tuples as second argument

2020-02-04 Thread Joachim Jablon


New submission from Joachim Jablon :

(Not really sure it is a bug, but better informed people might find it worthy 
still)

isinstance can accept, as second argument, a type or a potentially nested tuple 
of types. Only tuples are accepted, as opposed to generic iterables. The 
reasoning behind using a tuple was recently added through a small refactoring 
from Victor Stinner:
https://github.com/python/cpython/commit/850a4bd839ca11b59439e21dda2a3ebe917a9a16
The idea being that it's impossible to make a self referencing tuple nest, and 
thus the function, which is recursive, doesn't have to deal with infinite 
recursion.

It's possible to use a tuple subclass, though, and while it doesn't break the 
function because it reads , the tuple is not explored through the __iter__ 
interface:

>>> class T(tuple):
... def __iter__(self):
... yield self
... 
>>> isinstance(3, T())
False

This is the expected result if checking what the tuple contains, but not if 
iterating the tuple. For me, there's nothing absolutely wrong with the current 
behaviour, but it feels like we're walking on a fine line, and if for any 
reason, the isinstance tuple iteration were to start using __iter__ in the 
future, this example may crash. Solutions could be handling any iterable but 
explicitely checking for recursion or, as suggested by Victor Stinner, 
forbidding subclasses of tuple.

Guido van Rossum suggested opening an issue so here it is.

A link to the discussion that prompted this:
https://twitter.com/VictorStinner/status/122474460642164

--
messages: 361362
nosy: ewjoachim
priority: normal
severity: normal
status: open
title: isinstance accepts subtypes of tuples as second argument
type: behavior
versions: Python 3.9

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



[issue30670] pprint for dict in sorted order or insert order?

2019-02-04 Thread Joachim Jablon


Joachim Jablon  added the comment:

If you stop sorting keys in pprint, then unittest.TestCase.assertDictEquals() 
(and pytest and such) won't be able to generate a meaningful diff when 2 dicts 
aren't equal, and it will be much more complicated to understand why a test 
fails.

https://github.com/python/cpython/blob/89427cd0feae25bbc8693abdccfa6a8c81a2689c/Lib/unittest/case.py#L1172-L1175

(well except if we fix unittest, but then external test runners will need 
fixing too, and it might not be the only place diff is used on the result of 
pprint to see how two objects differ)

--
nosy: +ewjoachim

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