OT, but...

You have to use the complete module name?  Instead of `from callable_enum
> import Enum, Value`?  Ouch.


yes, but:

"""
Use from x import y as z if two modules named y are to be imported or if y is
an inconveniently long name.
"""

(https://google.github.io/styleguide/pyguide.html?showone=Imports#Imports)

So you can rename it if it's long:

import callable_enum as ce

class Greeting(callable_enum.Enum):
     HELLO = ce.Value(_greet_hello)
     GOODBYE = ce.Value(_greet_goodbye)
     TO_PYTHON_IDEAS =ce.Value(_welcome_to_python_ideas)

not too bad, and a pattern that has been pretty universally adopted by,
e.g., numpy:

import numpy as np.

I'm still on the fence for modules that I'm only using a couple names from
though...

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to