[Python-Dev] How far to go with user-friendliness
Ron Adam
ron3200 at gmail.com
Sun Jul 19 18:52:17 CEST 2015
On 07/19/2015 11:52 AM, Ethan Furman wrote:
> Seems to me a lot of fuss could have been avoided by just acknowledging
> that a mistake may have been made, and asking for patches if anybody cared
> enough about it.
I'm not sure it's a mistake, but it may not be the best way to do what the
"alias check" does. That is, check for "unsafe" methods that may use
"assert" in methods that start with assert or assret. It's a name
convention check only.
The use of "assret" may be because a developer used it in place of assert
for a large project to avoid overwriting inherited methods accidentally and
asked for it. (that was suggested in this thread at one point.) But I'm
not able to confirm that. It does sound reasonable though. The check for
it doesn't auto correct anything or alter anything outside of how the mock
responds to existing methods. So it's not as bad as it sounds. (But not as
good either.)
A possibly better alternative is to have a different way to check if
functions and methods use "assert". Then the check by name convention
(which is not dependable anyway) isn't needed.
Possibly adding a function, uses_assert(...), to the inspect module would
be good. To allow that to work, may need a flag set on function objects
if they contain assert even if the module is compiled in optimise mode.
(Is it doable? Or maybe there is another way?)
Cheers,
Ron
More information about the Python-Dev
mailing list