2018-06-05 10:08 GMT+02:00 Pål Grønås Drange <paal.dra...@gmail.com>: >> You can't import literals. They're syntax, not just bound names. > > I'm way out of my comfort zone now, but the parser could for > `123.45_f` > give > `__literal_f__(123.45)` > and then that function should be imported. > > I'm sure this idea has many shortcomings that I don't see, but that was the > reason why I wanted to import stuff. > > Pål
Before your code is executed, python scans your entire file for syntax errors. Since 123.45_f is currently not a valid literal, it'll just print a syntax error without even looking at your imports. To change that, the very core of python would need to look completely different. It'd be a metric fuckton of work for a whole lot of people. Im not a core dev myself or anything, but i'm pretty confident that this isn't going to happen for a rather minor need like this. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/