fake-useragent icon indicating copy to clipboard operation
fake-useragent copied to clipboard

PascalCase methods don't comply with Python's snake_case convention

Open sebastian-correa opened this issue 1 year ago • 1 comments

These methods

https://github.com/fake-useragent/fake-useragent/blob/ca2a736a00d56c92de4ad63046229ce56926c965/src/fake_useragent/fake.py#L346-L378

are written in PascalCase, which doesn't comply with the most common way to write Python: snake_case. I think this will be unexpected for developers used to the Python ecosystem.

~~Furthermore, if I didn't misread this, these methods duplicate the non get properties above:~~~

https://github.com/fake-useragent/fake-useragent/blob/ca2a736a00d56c92de4ad63046229ce56926c965/src/fake_useragent/fake.py#L301-L343

The Zen of Python says that There should be one-- and preferably only one --obvious way to do it., and I tend to agree.

Therefore, I propose we remove the PascalCased getters, in favor of just the properties.

This is a breaking change, so doing so will need a new major bump to v3. If we decide to move forwards with this, we should think about how to develop it so that we don't keep bumping major versions too often.

sebastian-correa avatar Dec 22 '24 17:12 sebastian-correa

Furthermore, if I didn't misread this, these methods duplicate the non get properties above:

Nope they are not. These "get" methods are returning the full JSON object, instead of only the user-agent string :)

melroy89 avatar Dec 22 '24 19:12 melroy89