I think that using operator= to set_state is powerful but there is arguably a drawback that should be discussed. I take aliases everywhere to simplify the code and everywhere do: x.y.z.foo() or equivalently: z = x.y.z z.foo() This is fine for method calls but assignment at the level of z is pure assignment (that is not forwarded to set_state). This is Pythonic, but I don't like it.
Activity
dnwillia-work commentedon Mar 3, 2022
So, you are saying that this:
works but
just ends up setting z to the object? eg: if it's a dictionary z would just be a dictionary after the second bit.
seanpearsonuk commentedon Mar 3, 2022
Yeah, that's it. It's all normal Python of course.
dnwillia-work commentedon Mar 3, 2022
Alright, just wanted to make sure I understand. Are you suggesting that we don't use operator= at all then for set_state?
seanpearsonuk commentedon Mar 18, 2022
I'm on the fence but closing this as the current form is idiomatic.
seanpearsonuk commentedon Jul 5, 2024
Reopening, pending further discussions.
[-]Pythonic assignment not up to scratch[/-][+]State assignment via settings objects[/+]seanpearsonuk commentedon Nov 7, 2024
Will not change the behaviour of this.
seanpearsonuk commentedon Mar 6, 2025
This assignment style is cropping up as an issue even for PyFluent developers.
https://github.com/ansys/pyfluent/pull/3807/files#r1983387948
Let's discuss.
seanpearsonuk commentedon Nov 20, 2026
Reopened.
I have marked this as relating to #5579. We could do both deprecations in a single release.
@prmukherj @mkundu1 @mayankansys @hpohekar
<state_object>.__call__()alias forget_state()#5579prmukherj commentedon Nov 20, 2026
Remove the syntactic sugar for
=from both settings and object model in PyFluent codebase.prmukherj commentedon Nov 28, 2026
This has been deprecated and a deprecation warning is being emitted for such scenarios.