[Python-ideas] .from and .to instead of .encode and .decode

anatoly techtonik techtonik at gmail.com
Thu Mar 19 11:41:01 CET 2015


On Wed, Mar 18, 2015 at 2:24 PM, Luciano Ramalho <luciano at ramalho.org> wrote:
>>
>>> A more objective problem is: "from" is a keyword, so it can't be a method name.
>>
>> I don't see why "from" can not be used as a method name in Python. It can not
>> be used as function name, because it will override the keyword, but method
>> names are always namespaced with self. or class prefixes.
>
> You can't write it's definition, "def from..." and you can't even
> write "x.from" without a SyntaxError (instead of NameError or
> AttributeError). Try it in the Python console.
>
> The parser would need to be changed.

And that won't break anything.
-- 
anatoly t.


More information about the Python-ideas mailing list