[Python-ideas] Quick idea: defining variables from functions that take the variable name

Sjoerd Job Postmus sjoerdjob at sjoerdjob.com
Wed Jun 1 09:37:47 EDT 2016



> On 1 Jun 2016, at 15:22, Sven R. Kunze <srkunze at mail.de> wrote:
> 
> On 01.06.2016 08:25, Sjoerd Job Postmus wrote:
>>> On 31 May 2016, at 16:37, Sven R. Kunze <srkunze at mail.de> wrote:
>>> 
>>> Btw. there would be huge use-case for Django development. So, given your explanation, it sounds useful.
>> Could you elaborate on that use-case, because I'm not seeing it. I think maybe you mean the ORM and declarative forms, correct?
> 
> Exactly. That is one reason why Django needs metaclasses all over the place. Because fields just don't know their name.
> 
> 
> This is especially true for forms as django does not magic there. It always causes headaches if you need it.
> 
> 
> Best,
> Sven
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

As an alternative suggestion, maybe there could be a `get_assignment_target` function which returns either a string, or `None`. No new syntax required at all, but it comes across to me as completely hacky.


More information about the Python-ideas mailing list