Earlier quoted context omitted.
> I can see the value in quickly knowing if new code is mucking with private/protected properties. Would this do it? re.findall(r'(? Anytime you're using ``obj._foo`` and it's not ``self._foo`` that suggests you're mucking about with the internals of an object that the author didn't expect you to use.
That would miss some things, like iteration of all properties without a direct reference, subclasses accessing _Parent__private stuff, etc. I'm not actively looking for a solution, just noting this might be more well received if you could easily turn it off and on. Edit: Again, not looking for solutions. I thought the feedback of being able to turn it on/off might be useful for the OP.
Lang: Python module for enforcing programming language constraints
11–20 of 21 posts
Re: Lang: Python module for enforcing programming language constraints
#12Re: Lang: Python module for enforcing programming language constraints
#13An impressive effort. Nonetheless, I feel like it would be better to warn about these things via static analysis rather than enforcing at run time.
Re: Lang: Python module for enforcing programming language constraints
#14So yeah, props for the effort, but I don't see it being actually used.
Re: Lang: Python module for enforcing programming language constraints
#15Trying to force the idioms of the programming language you just left onto the programming language you just learned is the classic sign of not having put any effort whatsoever into learning the idioms of the new programming language.
Re: Lang: Python module for enforcing programming language constraints
#16> Lang was built using a Java like mindset
I don't really understand why people want to make Python something which is not. Python is not Java, if you want to use Java constructs, use Java! That simple.
Re: Lang: Python module for enforcing programming language constraints
#17Being more like Java is about the last thing in the world python needs.
Re: Lang: Python module for enforcing programming language constraints
#18This makes me a little sad. So, a few observations: - The use of metaclasses for (almost?) every feature in this library makes it prone to metaclass conflicts. What if I want to inherit from two classes that use two different features from the library? >>> class MetaOne(type): ... pass ... >>> class MetaTwo(type): ... pass ... >>> class One(metaclass=MetaOne): ... pass ... >>> class Two(metaclass=MetaTwo): ... pass .…
Re: Lang: Python module for enforcing programming language constraints
#19This makes me a little sad. So, a few observations: - The use of metaclasses for (almost?) every feature in this library makes it prone to metaclass conflicts. What if I want to inherit from two classes that use two different features from the library? >>> class MetaOne(type): ... pass ... >>> class MetaTwo(type): ... pass ... >>> class One(metaclass=MetaOne): ... pass ... >>> class Two(metaclass=MetaTwo): ... pass .…
A little off topic, but it's possible to automatically resolve metaclass conflicts in cases like this (e.g. construct a minimal suitable metaclass on the fly) :)
Re: Lang: Python module for enforcing programming language constraints
#20I feel like this is the most anti-pythonic thing I've ever seen.