[issue40117] __round__ doesn't behave well with return NotImplemented

2020-03-30 Thread Hameer Abbasi


New submission from Hameer Abbasi :

Minimal reproducer:

>>> class A:
... def __round__(self):
... return NotImplemented
...
>>> round(A())
NotImplemented

Should give a TypeError.

This can be useful when deciding, for example, if a given a.dtype implements 
round based on the dtype

--
components: Interpreter Core
messages: 365323
nosy: Hameer Abbasi
priority: normal
severity: normal
status: open
title: __round__ doesn't behave well with return NotImplemented
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

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



[issue40117] __round__ doesn't behave well with return NotImplemented

2020-03-30 Thread Hameer Abbasi


Change by Hameer Abbasi :


--
type:  -> behavior

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



[issue36178] type.__init__ called instead of cls.__init__ when inheriting from type.

2019-03-04 Thread Hameer Abbasi


New submission from Hameer Abbasi :

I may be completely misunderstanding here, but: here's a reproducible example:

class MyMeta(type):
def __new__(cls, *args, **kwargs):
print('__new__', *args, **kwargs)
super().__new__(cls, *args, **kwargs)

def __init__(self, a):
print('__init__', *args, **kwargs)
super().__init__(*args, **kwargs)

class A(metaclass=MyMeta):
pass

MyMeta('A', (), {'__module__': '__main__', '__qualname__': 'A'})


Output:

__new__ A () {'__module__': '__main__', '__qualname__': 'A'}
__new__ A () {'__module__': '__main__', '__qualname__': 'A'}

Is this by design?

--
components: Interpreter Core
messages: 337079
nosy: Hameer Abbasi
priority: normal
severity: normal
status: open
title: type.__init__ called instead of cls.__init__ when inheriting from type.
type: behavior
versions: Python 3.7

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



[issue36178] type.__init__ called instead of cls.__init__ when inheriting from type.

2019-03-04 Thread Hameer Abbasi


Hameer Abbasi  added the comment:

Ah, I wasn't aware I had to return...

The bug was deliberate to show that not even a different signature makes a 
difference. ;)

--

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



[issue36359] contextvars documentation unclear on thread-locality

2019-03-19 Thread Hameer Abbasi


New submission from Hameer Abbasi :

The documentation here: https://docs.python.org/3/library/contextvars.html does 
not mention anything about context-variables being thread-local or not. It 
should definitely make that more clear.

I was told by Freenode user njs (I strongly suspect its Nathaniel J. Smith) 
that they are.

--
assignee: docs@python
components: Documentation
messages: 338322
nosy: Hameer Abbasi2, docs@python, yselivanov
priority: normal
severity: normal
status: open
title: contextvars documentation unclear on thread-locality
type: enhancement
versions: Python 3.7, Python 3.8

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