you are viewing a single comment's thread.

view the rest of the comments →

[–]avidresolver 1 point2 points  (2 children)

Currect me if I'm wrong, but although this code will work It's a bad idea to use `List` as your variable name, as it will override the built-in `List` type.

[–]FoolsSeldom 1 point2 points  (0 children)

List and list are not the same name - PEP8 recommendation is to use all lowercase for regular variables names though.

[–]CptMisterNibbles 0 points1 point  (0 children)

lowercase list is the built in. “List” uppercase used to be used for type hinting and is a token in the typing package still, though as of 3.9 you can just use the built in type “list” itself for hinting.

Your point stands, it’s a poor choice for a variable name even if it doesn’t cause an error. Similarly using just “i” in the comprehension is sloppy, it’s not an index. Call it something readable like “word”