miyuchina / mistletoe

A fast, extensible and spec-compliant Markdown parser in pure Python.
MIT License
818 stars 118 forks source link

`block_token.List.start` is both a classmethod and attribute #205

Open TeamSpen210 opened 10 months ago

TeamSpen210 commented 10 months ago

While looking through the codebase to understand it (and maybe write some type stubs), I noticed that block_token.List has both a classmethod start(), and an attribute with that same name. This does happen to work, but it's rather awkward, and might confuse various tools (or humans).

The classmethod seems to be common to all the token classes, so it seems better to rename the attribute form. (ordinal perhaps?) Either way it's backwards incompatible, though a custom descriptor class could be used temporarily to produce warnings.

pbodnar commented 9 months ago

@TeamSpen210, thanks for pointing out this, hopefully just minor, issue. I think we can consider fixing it at some point, possibly when doing some bigger code cleanup. Provided we would rename the start attribute, I would vote e.g. for start_num (ordinal comes too generic to me).