PEP8 all the functions #186

Closed
opened 2013-04-29 08:37:34 -07:00 by michaelhelmick · 4 comments
michaelhelmick commented 2013-04-29 08:37:34 -07:00 (Migrated from github.com)

Per http://www.python.org/dev/peps/pep-0008/#function-names

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

Currently, functions in Twython are all camelCase, maybe in 2.9.0; deprecate those functions and start switching users to use get_user_timeline instead of getUserTimeline?

Totally up to you @ryanmcgrath - Just trying to find things that could be cleaned up!

Per http://www.python.org/dev/peps/pep-0008/#function-names > Function names should be lowercase, with words separated by underscores as necessary to improve readability. > > mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility. Currently, functions in `Twython` are all camelCase, maybe in 2.9.0; deprecate those functions and start switching users to use `get_user_timeline` instead of `getUserTimeline`? Totally up to you @ryanmcgrath - Just trying to find things that could be cleaned up!
ryanmcgrath commented 2013-05-04 13:14:01 -07:00 (Migrated from github.com)

Honestly, we could accomplish this (~90%) by just maintaining another dictionary that points to the original, or vice-versa. Could even, on instantiation of a Twython object, just build an inner dict that camel-cases function names and points to the dict file (updated to PEP8 standards), so both would work, but new people would only see the PEP8 functions.

Actually... that sounds like the best method, no? Something like (off the top of my head, on my phone...):

n = 'get_user_timeline'
n = n.title().replace('_')
n = n[0].lower() + n[1:]

I think that'd work. That lets us get this in really easily without it actually being much of a breaking change at all.

Honestly, we could accomplish this (~90%) by just maintaining another dictionary that points to the original, or vice-versa. Could even, on instantiation of a `Twython` object, just build an inner dict that camel-cases function names and points to the dict file (updated to PEP8 standards), so both would work, but new people would only see the PEP8 functions. Actually... that sounds like the best method, no? Something like (off the top of my head, on my phone...): ``` python n = 'get_user_timeline' n = n.title().replace('_') n = n[0].lower() + n[1:] ``` I think that'd work. That lets us get this in really easily without it actually being much of a breaking change at all.
michaelhelmick commented 2013-05-04 13:21:11 -07:00 (Migrated from github.com)

That would get it, sir! I'll be on vacation next week so if you don't get around to it, I'll get around to it next weekend :)

That would get it, sir! I'll be on vacation next week so if you don't get around to it, I'll get around to it next weekend :)
ryanmcgrath commented 2013-05-04 13:37:58 -07:00 (Migrated from github.com)

Awesome sauce. If I find some time tonight I'll see if I can't make it happen right quick.

Awesome sauce. If I find some time tonight I'll see if I can't make it happen right quick.
michaelhelmick commented 2013-05-04 13:41:12 -07:00 (Migrated from github.com)

Cool beans!

Sent from my iPhone

On May 4, 2013, at 4:37 PM, Ryan McGrath notifications@github.com wrote:

Awesome sauce. If I find some time tonight I'll see if I can't make it happen right quick.


Reply to this email directly or view it on GitHub.

Cool beans! Sent from my iPhone On May 4, 2013, at 4:37 PM, Ryan McGrath notifications@github.com wrote: > Awesome sauce. If I find some time tonight I'll see if I can't make it happen right quick. > > — > Reply to this email directly or view it on GitHub.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#186
No description provided.