ericvsmith / dataclasses

Apache License 2.0
587 stars 53 forks source link

An InitVar could allow a default_factory #147

Closed jdevera closed 5 years ago

jdevera commented 5 years ago

Having a default_factory in an InitVar is actively prevented, but I do not understand why. Git history inspection doesn't clarify either. I tried SO too: https://stackoverflow.com/questions/57056029/

What is the reason behind this restriction?

Could this be easily enabled in newer versions? What would be the process to move that forward if it makes sense?

ericvsmith commented 5 years ago

I don't recall the exact reason, but it no doubt has something to do with when the default factory is called.

In any event, this is the wrong place for this issue. This repo is just about the backport to 3.6. I suggest you open an issue on bugs.python.org, requesting that this feature be added. We can discuss why it can or can't be done over there.

dmwyatt commented 2 years ago

@jdevera Did you ever open a bug? Just at python.org? Just looking for a link to the discussion if so...

jdevera commented 2 years ago

@dmwyatt I didn't, and in the meantime, I have entirely forgotten the context of what I was trying to do. If this is affecting you, python bugs now live here: https://github.com/python/cpython/issues

jdevera commented 2 years ago

In any case, there was an answer in my SO question last year: https://stackoverflow.com/a/72332932