[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-03-20 Thread Luis E.


Change by Luis E. :


--
components:  -Documentation

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



[issue40025] enum: _generate_next_value_ is not called if its definition occurs after calls to auto()

2020-03-20 Thread Luis E.


New submission from Luis E. :

I ran into this issue when attempting to add a custom _generate_next_value_ 
method to an existing Enum. Adding the method definition to the bottom of the 
class causes it to not be called at all:

from enum import Enum, auto

class E(Enum):
A = auto()
B = auto()
def _generate_next_value_(name, *args):
return name


E.B.value  # Returns 2, E._generate_next_value_ is not called

class F(Enum):
def _generate_next_value_(name, *args):
return name
A = auto()
B = auto()


F.B.value  # Returns 'B', as intended


I do not believe that the order of method/attribute definition should affect 
the behavior of the class, or at least it should be mentioned in the 
documentation.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 364665
nosy: docs@python, edd07
priority: normal
severity: normal
status: open
title: enum: _generate_next_value_ is not called if its definition occurs after 
calls to auto()
type: behavior
versions: Python 3.7

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



[issue38260] asyncio.run documentation does not mention its return value

2019-09-23 Thread Luis E.


New submission from Luis E. :

The documentation for asyncio.run 
(https://docs.python.org/3/library/asyncio-task.html#asyncio.run) does not 
mention the function's return value or lack of one.

Looking at the source, its clear it returns the passed coroutine's value via 
loop.run_until_complete, but the documentation or the provided example do not 
make it clear.

--
assignee: docs@python
components: Documentation, asyncio
messages: 353033
nosy: asvetlov, docs@python, edd07, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.run documentation does not mention its return value
type: enhancement
versions: Python 3.7

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