#samalba0001 et al Python s convention is

1 messages · Page 1 of 1 (latest)

gilded geyser
#

We can call it ƒrom instead 🙂

But actually, that's a tough situation, is suffixing w/ _ a pattern used elsewhere? Just curious

remote raptor
#

Yes, it's a convention for avoiding name collisions. So also class_, although most people just use klass or cls. But type_ is common.

#

An underscore before means private, an underscore afterwards avoids a conflict, before and after means special, and two before and two after means magic or meta 😛

gilded geyser
#

Ah okay, I mean if it's a convention in the language then it is probably the right call. I think that's a good guiding principal in general for all the SDKs.

remote raptor
#

Yep

#

But it's still a preference to avoid just for aesthetics.

#
core.container().with_default_args(args=["wat"]).from_(ref="alpine").default_args
gilded geyser
#

We can also change the use of from in our API itself as a one-off fix to this particular instance of grossness. But that's obviously not a general solution, can't avoid reserved words across every possible language and every possible API. So we'll still need to have the _ suffix handling in place for Python and similar fixes for each other lang

#

We'll run into the same thing eventually when someone wants to call a field in their extension go I guess.

#

Well actually there we can capitalize as a fix

#

But either way, the problem will come up again I'm sure in TS and other future langs

late matrix
#

I agree with lower case for functions and also 'from_' is acceptable, I think it's a common convention to avoid conflicts with keywords

remote raptor