On Mon, Jan 20, 2020 at 5:23 PM Soni L. <fakedme...@gmail.com> wrote:
> What the eff is this then?
> https://docs.python.org/3/library/importlib.html#module-importlib.resources
>
> Because I'm pretty sure this is literally part of the existing import
> machinery. Because importlib *is* the existing import machinery. But
> what do I know, I'm only a person who reads what it says right there at
> the top of the module...

No need to get caustic. Remember, not everyone is aware of everything
that the standard library has. To my knowledge, this is the first time
that importlib.resources has been mentioned in this thread, and you
proposed something very similar as though it were a new feature,
without any reference to this module.

> It wouldn't be an expression in itself, it would be an expression *in a
> fstring*. fstrings *do not follow normal python syntax* so we can
> literally add a rule that says "if you see '{from $NAME import $STR}' in
> an fstring, do this" to the syntax. it doesn't need to become an
> expression, it just needs to turn the '{...}' part into the desired
> value. oh and, for that reason, no modifiers or whatnot would be applicable.

I don't understand the point of having this in an f-string. Are you
going to do constructs like:

response = bf"""HTTP/1.0 404 NOT FOUND
{headers}

{from foo.bar import 'foo.txt'}
"""

where you combine these magic imports with other content? If not, why
not just use a simple function call?

Lately, I've been seeing a number of python-ideas posts that have the
feeling of "this is a new toy, let's use it in even more places". Just
because := and f"..." exist, they have to be used for everything?

> if import was a function then we wouldn't have "from foo import *" and
> we wouldn't be having this argument. it's not a function tho ;)

>>> __import__("sys")
<module 'sys' (built-in)>

:)

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/Y6WAWFE4ZDD7SLF5J2MDG7OPCFBJBUJJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to