I have many times had situations where I had a variable of a certain type, all 
I cared about it was one of it's methods.

For example:

------------------------------------------------------------
import hashlib
hash = hashlib.sha256(b'word')
hash = hash.hexdigest()
------------------------------------------------------------
import enum
class Number(enum.Enum):
        One: int = 1
        Two: int = 2
        Three: int = 3
num = Number.One
num = num.value
------------------------------------------------------------

Now to be fair, in the two situations above, I could just access the method 
right as I declare the object, however, sometimes when passing values into 
functions, it's a lot messier to do that.

So what I'm suggesting is something like this:

------------------------------------------------------------
import hashlib
hash = hashlib.sha256(b'word')
hash.=hexdigest()
------------------------------------------------------------
import enum
class Number(enum.Enum):
        One: int = 1
        Two: int = 2
        Three: int = 3
num = Number.One
num.=value
------------------------------------------------------------
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to