Skip to content

Various design issues with Python snippets #1472

Open
@NeilGirdhar

Description

@NeilGirdhar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions