Skip to main content
Code Review

Return to Revisions

2 of 2
Commonmark migration

Styleguide (PEP8)

  • avoid useless comments
  • you should have two new lines between your methods
  • docstrings should be written within triple double-quotes
  • after # you should have a space

Identity vs equality

There is a simple rule of thumb to tell you when to use == or is.

  • == is for value equality. Use it when you would like to know if two objects have the same value.
  • is is for reference equality. Use it when you would like to know if two references refer to the same object.

For example:

def not_singleton(tag):
 return is_singleton(tag) == False

Should actually be:

def not_singleton(tag):
 return is_singleton(tag) is False

Iterating over keys and values of a dict

Instead of this:

for key, value in zip(kw.keys(), kw.values()):
 ...

You should do this:

for key, value in kw.items():
 ...

To be continued

Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
default

AltStyle によって変換されたページ (->オリジナル) /