Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various design issues with Python snippets #1472

Open
NeilGirdhar opened this issue Dec 7, 2022 · 0 comments
Open

Various design issues with Python snippets #1472

NeilGirdhar opened this issue Dec 7, 2022 · 0 comments

Comments

@NeilGirdhar
Copy link

There are a variety of design issues with the Python snippets. Instead of making a separate issue for each, I'll summarize them here for discussion purposes.

The "class" snippet tries to explicity call __init__ on the base classes. This is generally incorrect, and can cause double-initialization if there any diamond inheritance patterns.

The "dcl" snippet has a syntax error. It's probably best to keep only the first field.

There's a bug with the " snippet. It seems to miss two of the final quotation marks.

Python 2 is dead, so "#!2" and "uni" should probably be removed.

The "contain" snippet lists most of the methods of a mutable sequence. A container only needs __contains__. Also, __reversed__ should be removed (It's provided by collections.abc.MutableSequence and insert should be added.) See https://docs.python.org/3/library/collections.abc.html for more information.

The "repr" snippet has a now useless __unicode__ method and numeric shoul remove hex, oct, coerce, and long.

The unittest library is generally supplante by pytest, so "sk" should probably be removed or updated to call pytest.skip. Similarly, "a=", "test", "testcase" should be removed since pytest favors bare function fixtures over classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant