Google Python Style Guide

305 views
Skip to first unread message

Dan O'Boyle

unread,
Apr 19, 2012, 8:46:26 AM4/19/12
to pu...@googlegroups.com
I thought this was interesting, and wanted to share

Brian Jones

unread,
Apr 19, 2012, 9:18:37 AM4/19/12
to pu...@googlegroups.com


On Thu, Apr 19, 2012 at 8:46 AM, Dan O'Boyle <oboy...@gmail.com> wrote:
> I thought this was interesting, and wanted to share
>
> http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

I use that, along with PEP8 and PEP257, and a couple of other peps I can't remember right now. All of that *still* doesn't cover everything, but it lays a good foundation. 

Worth noting that, while PEP8 is technically the style guide for those writing code to be merged into the core language itself, it's very widely used and adhered to in open source projects and other community efforts. It's also used (in conjunction with Google's style guide) by corporations who have a significant investment in Python. 

brian


--
Brian K. Jones
My Blog          http://www.protocolostomy.com
Follow me      http://twitter.com/bkjones

Dan O'Boyle

unread,
Apr 19, 2012, 9:27:04 AM4/19/12
to pu...@googlegroups.com
So what your saying is, there's a reason it was on the front page of Hacker News today? ;-)

Thanks Brian, good info.  I'm looking at PyCharm as an IDE to work from, can you mention anything for/against learning on it?

Brian Jones

unread,
Apr 19, 2012, 10:44:36 AM4/19/12
to pu...@googlegroups.com
On Thu, Apr 19, 2012 at 9:27 AM, Dan O'Boyle <oboy...@gmail.com> wrote:
So what your saying is, there's a reason it was on the front page of Hacker News today? ;-)

Thanks Brian, good info.  I'm looking at PyCharm as an IDE to work from, can you mention anything for/against learning on it?

Well... I'm kind of *not* an advocate of using an IDE when you're learning a language, because I think an IDE is something you *also* have to learn. I'd hate to have to learn (or teach someone else) a language *and* an IDE at the same time. Use something simple that you already know how to use. An IDE sort of assumes that you understand the workings of the language you're coding in, and therefore all of the alerts it gives you based on code inspections will make sense to you. If you don't know the language, that seems like it'd all be very annoying, no? 

PyCharm, however, is a great IDE, if you just want to keep one around. 

We should have another IDE/editor smackdown. I missed the last one. 
We also need a talk for the May meeting. Let me know if anyone has ideas. 

brian



On Thu, Apr 19, 2012 at 9:18 AM, Brian Jones <bkj...@gmail.com> wrote:


On Thu, Apr 19, 2012 at 8:46 AM, Dan O'Boyle <oboy...@gmail.com> wrote:
> I thought this was interesting, and wanted to share
>
> http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

I use that, along with PEP8 and PEP257, and a couple of other peps I can't remember right now. All of that *still* doesn't cover everything, but it lays a good foundation. 

Worth noting that, while PEP8 is technically the style guide for those writing code to be merged into the core language itself, it's very widely used and adhered to in open source projects and other community efforts. It's also used (in conjunction with Google's style guide) by corporations who have a significant investment in Python. 

brian


--
Brian K. Jones
My Blog          http://www.protocolostomy.com
Follow me      http://twitter.com/bkjones


Kevin Marshall

unread,
Apr 19, 2012, 10:58:48 AM4/19/12
to pu...@googlegroups.com
Just my two cents, but if you are on a Mac I highly recommend TextMate
( macromates.com )...it's pretty cheap, and is really just a plain
text editor that can do color coding for most every language...also
you can install things like PyFlakes (
http://justcramer.com/2010/11/30/integrating-pyflakes-into-textmate/ )
and PEP8 helpers ( https://github.com/ppierre/python-pep8-tmbundle )
that can save you tons of time in debugging and help you write
cleaner, more friendly Python specifically.

If you are on a Windows based machine, I just context editor (
http://www.contexteditor.org/ ) which is just a simple, free, text
editor (that feels very much like TextMate)...I haven't looked/found
plugins for it like PyFlakes or PEP8 to help with Python specifically
there, but they may exist as well.

If you're on another platform, then you're probably a bit more
hardcore/old-school of a developer and so VIM, emacs, or nano are
probably your best options as simple text editors for code...though I
*really* wouldn't want to learn on any of those in today's world...

- Kevin

Dan Worth

unread,
Apr 19, 2012, 11:16:50 AM4/19/12
to pu...@googlegroups.com
Yeah, +1 for TextMate.  

There is also Sublime Text 2 (http://www.sublimetext.com/2) which has support for Windows/OS X and Linux.

I played around with Sublime Text 2 and even thought about switching but I still use TextMate all day everyday :/

Another interesting tidbit about Sublime Text 2 is that it's configuration system uses python dicts which I thought was pretty cool

Thanks,
  Dan W.
--
Thanks,
  - Dan W.

Chris Curvey

unread,
Apr 19, 2012, 11:30:24 AM4/19/12
to pu...@googlegroups.com
I will give my usual "thumbs-up" for Wing.  I think it does a great job, and the support from the authors is amazing.
--
e-Mail is the equivalent of a postcard written in pencil.  This message may not have been sent by me, or intended for you.  It may have been read or even modified while in transit.  e-Mail disclaimers have the same force in law as a note passed in study hall.  If your corporate attorney says that you need an disclaimer in your signature, you need a new corporate attorney.

Dan O'Boyle

unread,
Apr 20, 2012, 10:05:41 AM4/20/12
to pu...@googlegroups.com
Thanks for all the feedback on python Tools.  

I should probably start this as a new message - but I wanted to share a frustration I'm having with Flask.  

I understand that the standard boxed web server is great for users without any administration chops.  What i'd like is to integrate Flask, or any python web framework, into a more powerful web server like apache 2.  If anyone has a decent guide for doing this, or would possibly be willing to do a talk on it,  I would REALLY appreciate it!

Dan

Brian Jones

unread,
Apr 20, 2012, 10:22:03 AM4/20/12
to pu...@googlegroups.com
On Fri, Apr 20, 2012 at 10:05 AM, Dan O'Boyle <oboy...@gmail.com> wrote:
Thanks for all the feedback on python Tools.  

I should probably start this as a new message - but I wanted to share a frustration I'm having with Flask.  

I understand that the standard boxed web server is great for users without any administration chops.  What i'd like is to integrate Flask, or any python web framework, into a more powerful web server like apache 2.  If anyone has a decent guide for doing this, or would possibly be willing to do a talk on it,  I would REALLY appreciate it!

I feel your pain. I haven't deployed Flask with a 'real' server yet, but I did come across this in the Flask docs, so it should get you headed in the right direction at least: http://flask.pocoo.org/docs/deploying/

Dan O'Boyle

unread,
Apr 20, 2012, 10:24:05 AM4/20/12
to pu...@googlegroups.com
Thanks Brian. I'll look at it this weekend.

I still think it would make a great talk.  (I might even be willing to lead it if I have success this weekend)

Dan

James Polera

unread,
Apr 20, 2012, 10:48:51 AM4/20/12
to <pugip@googlegroups.com>
Hey Dan,

I actually used Flask in my "Practical Python Web Deployments" talk back in February.  Configs for various scenarios involving Apache 2, nginx, and Heroku are available (in branches) here:



Hope that helps!

- James

Dan O'Boyle

unread,
Apr 20, 2012, 10:58:19 AM4/20/12
to pu...@googlegroups.com
Thanks James! I'll add it to my reading this weekend.
Dan
Reply all
Reply to author
Forward
0 new messages