Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101816

Re: Python best practices

From Bob Gailer <bgailer@gmail.com>
Newsgroups comp.lang.python
Subject Re: Python best practices
Date 2016-01-16 14:41 -0500
Message-ID <mailman.46.1452973301.15297.python-list@python.org> (permalink)
References <a746ac38-3e2f-4af6-aa6c-6512cda62cb7@googlegroups.com>

Show all headers | View raw


On Jan 15, 2016 8:20 PM, <gliesian66@gmail.com> wrote:
>
> Are there any good resources on python best practices?  e.g., articles

What programming experience do you have? I'm thinking of languages.

Here are a few of my guidelines - most not Python specific:

Keep logic and data separate.

Comment early and often - but don't comment the obvious.

Use meaningful names.

Read the manuals.

Get familiar with modules. Someone has likely already solved the problem.

Do not override built-in names.

Follow these email lists.

Avoid things like "if valid == True:".
"if valid:" is sufficient.

Read the manuals.

When asking for help:
  Use a problem-specific subject.
  Use plain text so code keeps indentation
  Mention your Python version and OS.
  Include any traceback.

If something is not clear try it in the interactive window.

Dictionaries are very useful. Get familiar with them.

HTH.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python best practices gliesian66@gmail.com - 2016-01-15 17:19 -0800
  Re: Python best practices Steven D'Aprano <steve@pearwood.info> - 2016-01-16 13:32 +1100
  Re: Python best practices Bob Gailer <bgailer@gmail.com> - 2016-01-16 14:41 -0500
  Re: Python best practices Felix Almeida <felix.almeida@gmail.com> - 2016-01-16 15:16 -0500

csiph-web