Instantly share code, notes, and snippets.

Embed
What would you like to do?
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
  • "Fit the 90% use-case. Ignore the nay sayers." - Kenneth Reitz
  • "Beautiful is better than ugly." - PEP 20
  • Build for open source (even for closed source projects).

General Development Guidelines

  • "Explicit is better than implicit" - PEP 20
  • "Readability counts." - PEP 20
  • "Anybody can fix anything." - Khan Academy Development Docs
  • Fix each broken window (bad design, wrong decision, or poor code) as soon as it is discovered.
  • "Now is better than never." - PEP 20
  • Test ruthlessly. Write docs for new features.
  • Even more important that Test-Driven Development--Human-Driven Development
  • These guidelines may--and probably will--change.

In Particular

Style

Follow PEP 8, when sensible.

Naming

  • Variables, functions, methods, packages, modules
    • lower_case_with_underscores
  • Classes and Exceptions
    • CapWords
  • Protected methods and internal functions
    • _single_leading_underscore(self, ...)
  • Private methods
    • __double_leading_underscore(self, ...)
  • Constants
    • ALL_CAPS_WITH_UNDERSCORES
General Naming Guidelines

Avoid one-letter variables (esp. l, O, I).

Exception: In very short blocks, when the meaning is clearly visible from the immediate context

Fine

for e in elements:
    e.mutate()

Avoid redundant labeling.

Yes

import audio

core = audio.Core()
controller = audio.Controller()

No

import audio

core = audio.AudioCore()
controller = audio.AudioController()

Prefer "reverse notation".

Yes

elements = ...
elements_active = ...
elements_defunct = ...

No

elements = ...
active_elements = ...
defunct_elements ...

Avoid getter and setter methods.

Yes

person.age = 42

No

person.set_age(42)

Indentation

Use 4 spaces--never tabs. Enough said.

Imports

Import entire modules instead of individual symbols within a module. For example, for a top-level module canteen that has a file canteen/sessions.py,

Yes

import canteen
import canteen.sessions
from canteen import sessions

No

from canteen import get_user  # Symbol from canteen/__init__.py
from canteen.sessions import get_session  # Symbol from canteen/sessions.py

Exception: For third-party code where documentation explicitly says to import individual symbols.

Rationale: Avoids circular imports. See here.

Put all imports at the top of the page with three sections, each separated by a blank line, in this order:

  1. System imports
  2. Third-party imports
  3. Local source tree imports

Rationale: Makes it clear where each module is coming from.

Documentation

Follow PEP 257's docstring guidelines. reStructured Text and Sphinx can help to enforce these standards.

Use one-line docstrings for obvious functions.

"""Return the pathname of ``foo``."""

Multiline docstrings should include

  • Summary line
  • Use case, if appropriate
  • Args
  • Return type and semantics, unless None is returned
"""Train a model to classify Foos and Bars.

Usage::

    >>> import klassify
    >>> data = [("green", "foo"), ("orange", "bar")]
    >>> classifier = klassify.train(data)

:param train_data: A list of tuples of the form ``(color, label)``.
:rtype: A :class:`Classifier <Classifier>`
"""

Notes

  • Use action words ("Return") rather than descriptions ("Returns").
  • Document __init__ methods in the docstring for the class.
class Person(object):
    """A simple representation of a human being.

    :param name: A string, the person's name.
    :param age: An int, the person's age.
    """
    def __init__(self, name, age):
        self.name = name
        self.age = age
On comments

Use them sparingly. Prefer code readability to writing a lot of comments. Often, small methods are more effective than comments.

No

# If the sign is a stop sign
if sign.color == 'red' and sign.sides == 8:
    stop()

Yes

def is_stop_sign(sign):
    return sign.color == 'red' and sign.sides == 8

if is_stop_sign(sign):
    stop()

When you do write comments, remember: "Strunk and White apply." - PEP 8

Line lengths

Don't stress over it. 80-100 characters is fine.

Use parentheses for line continuations.

wiki = (
    "The Colt Python is a .357 Magnum caliber revolver formerly manufactured "
    "by Colt's Manufacturing Company of Hartford, Connecticut. It is sometimes "
    'referred to as a "Combat Magnum". It was first introduced in 1955, the '
    "same year as Smith & Wesson's M29 .44 Magnum."
)

Testing

Strive for 100% code coverage, but don't get obsess over the coverage score.

General testing guidelines

  • Use long, descriptive names. This often obviates the need for doctrings in test methods.
  • Tests should be isolated. Don't interact with a real database or network. Use a separate test database that gets torn down or use mock objects.
  • Prefer factories to fixtures.
  • Never let incomplete tests pass, else you run the risk of forgetting about them. Instead, add a placeholder like assert False, "TODO: finish me".

Unit Tests

  • Focus on one tiny bit of functionality.
  • Should be fast, but a slow test is better than no test.
  • It often makes sense to have one testcase class for a single class or model.
import unittest
import factories

class PersonTest(unittest.TestCase):
    def setUp(self):
        self.person = factories.PersonFactory()

    def test_has_age_in_dog_years(self):
        self.assertEqual(self.person.dog_years, self.person.age / 7)

Functional Tests

Functional tests are higher level tests that are closer to how an end-user would interact with your application. They are typically used for web and GUI applications.

  • Write tests as scenarios. Testcase and test method names should read like a scenario description.
  • Use comments to write out stories, before writing the test code.
import unittest

class TestAUser(unittest.TestCase):

    def test_can_write_a_blog_post(self):
        # Goes to the her dashboard
        ...
        # Clicks "New Post"
        ...
        # Fills out the post form
        ...
        # Clicks "Submit"
        ...
        # Can see the new post
        ...

Notice how the testcase and test method read together like "Test A User can write a blog post".

Inspired by...

@vaibhav-jain

This comment has been minimized.

Show comment
Hide comment
@vaibhav-jain

vaibhav-jain Jan 19, 2015

Awesome guide..

vaibhav-jain commented Jan 19, 2015

Awesome guide..

@kunal-mazumdar

This comment has been minimized.

Show comment
Hide comment
@kunal-mazumdar

kunal-mazumdar Oct 2, 2015

simply great 💯

kunal-mazumdar commented Oct 2, 2015

simply great 💯

@kowalcj0

This comment has been minimized.

Show comment
Hide comment
@kowalcj0

kowalcj0 commented Nov 7, 2015

+1 :)

@andrecp

This comment has been minimized.

Show comment
Hide comment
@andrecp

andrecp commented Nov 7, 2015

+1 !

@warvariuc

This comment has been minimized.

Show comment
Hide comment
@warvariuc

warvariuc Nov 8, 2015

Nice guide, though I don't agree with some of the things. For example:

Document __init__ methods in the docstring for the class.

You place the docstring after the class name, then you have a bunch of class attributes, and now have to look at arguments of __init__ in one place and their meaning in other :(

warvariuc commented Nov 8, 2015

Nice guide, though I don't agree with some of the things. For example:

Document __init__ methods in the docstring for the class.

You place the docstring after the class name, then you have a bunch of class attributes, and now have to look at arguments of __init__ in one place and their meaning in other :(

@alch3m1st

This comment has been minimized.

Show comment
Hide comment
@alch3m1st

alch3m1st Nov 8, 2015

Great source! But what about type hinting - PEP 0484?

alch3m1st commented Nov 8, 2015

Great source! But what about type hinting - PEP 0484?

@svanoort

This comment has been minimized.

Show comment
Hide comment
@svanoort

svanoort Nov 8, 2015

Good stuff, big +1.

svanoort commented Nov 8, 2015

Good stuff, big +1.

@gustavohenrique

This comment has been minimized.

Show comment
Hide comment
@gustavohenrique

gustavohenrique commented Nov 9, 2015

Very good!

@zazapeta

This comment has been minimized.

Show comment
Hide comment
@zazapeta

zazapeta Nov 11, 2015

♥ wath else ?

zazapeta commented Nov 11, 2015

♥ wath else ?

@DarthJack007

This comment has been minimized.

Show comment
Hide comment
@DarthJack007

DarthJack007 Nov 11, 2015

Well, this make things a lot easier, thanks for the tips man. ☺

DarthJack007 commented Nov 11, 2015

Well, this make things a lot easier, thanks for the tips man. ☺

@victor-mendes-eduardo

This comment has been minimized.

Show comment
Hide comment
@victor-mendes-eduardo

victor-mendes-eduardo commented Nov 12, 2015

Nice help!

@datamafia

This comment has been minimized.

Show comment
Hide comment
@datamafia

datamafia Nov 12, 2015

Picked up a few new ones, thx.

datamafia commented Nov 12, 2015

Picked up a few new ones, thx.

@kronosapiens

This comment has been minimized.

Show comment
Hide comment
@kronosapiens

kronosapiens Nov 12, 2015

Good guide, thank you.

kronosapiens commented Nov 12, 2015

Good guide, thank you.

@fherdom

This comment has been minimized.

Show comment
Hide comment
@fherdom

fherdom commented Nov 13, 2015

+1

@luizpericolo

This comment has been minimized.

Show comment
Hide comment
@luizpericolo

luizpericolo Nov 13, 2015

A very good guide! Kudos

luizpericolo commented Nov 13, 2015

A very good guide! Kudos

@laike9m

This comment has been minimized.

Show comment
Hide comment
@laike9m

laike9m Nov 13, 2015

Great post!

laike9m commented Nov 13, 2015

Great post!

@wangst321

This comment has been minimized.

Show comment
Hide comment
@wangst321

wangst321 commented Nov 14, 2015

+1

@smitty1eGH

This comment has been minimized.

Show comment
Hide comment
@smitty1eGH

smitty1eGH commented Nov 21, 2015

Like

@otov4its

This comment has been minimized.

Show comment
Hide comment
@otov4its

otov4its Nov 26, 2015

Very well!

otov4its commented Nov 26, 2015

Very well!

@julie777

This comment has been minimized.

Show comment
Hide comment
@julie777

julie777 Nov 29, 2015

In general I agree and think they are good tips.

I strongly disagree with "reverse notation"!
The readability of Python is one of its greatest strengths. However, it still takes time and effort to do the best job possible. One of the most difficult problems reading other people's code is understanding names. Another is having reading disruptions. Reverse notation is very hard to read, especially for English speakers. It may have seemed like a nice grouping mechanism half a century ago (FileOpen, FileClose, FileRead), but that time is past and we have learned much.

The simplest and almost universal rule is that objects should be named as noun or noun phrases (adjective-noun) and functions/methods should be verbs or verb phrases (verb-object). The often unmentioned part is that word order should match written English. This leads to both understandable and readable code.

Compare and contrast reverse notation vs. reading style notation.
Reverse Notation:
bob = PersonBad(name_first='Bob', name_last='Smith')
bob.throw(ball_orange)
The verb-object function form is more often useful with functions, as the is no obvious context provided by the object.
file_delete(some_string) # delete() is much less obvious.

Normal English language style.
bob = GoodPerson(first_name='Bob', last_name='Smith')
bob.throw(orange_ball)
The verb-object for is very useful for free functions.
throw_ball(somename)
There is even a good use for a more extended verb phrase, which in this case clarifies the units.
start = convert_seconds_to_milliseconds(time.time())

julie777 commented Nov 29, 2015

In general I agree and think they are good tips.

I strongly disagree with "reverse notation"!
The readability of Python is one of its greatest strengths. However, it still takes time and effort to do the best job possible. One of the most difficult problems reading other people's code is understanding names. Another is having reading disruptions. Reverse notation is very hard to read, especially for English speakers. It may have seemed like a nice grouping mechanism half a century ago (FileOpen, FileClose, FileRead), but that time is past and we have learned much.

The simplest and almost universal rule is that objects should be named as noun or noun phrases (adjective-noun) and functions/methods should be verbs or verb phrases (verb-object). The often unmentioned part is that word order should match written English. This leads to both understandable and readable code.

Compare and contrast reverse notation vs. reading style notation.
Reverse Notation:
bob = PersonBad(name_first='Bob', name_last='Smith')
bob.throw(ball_orange)
The verb-object function form is more often useful with functions, as the is no obvious context provided by the object.
file_delete(some_string) # delete() is much less obvious.

Normal English language style.
bob = GoodPerson(first_name='Bob', last_name='Smith')
bob.throw(orange_ball)
The verb-object for is very useful for free functions.
throw_ball(somename)
There is even a good use for a more extended verb phrase, which in this case clarifies the units.
start = convert_seconds_to_milliseconds(time.time())

@hungtrinh

This comment has been minimized.

Show comment
Hide comment
@hungtrinh

hungtrinh Dec 2, 2015

thanks, you save my time

hungtrinh commented Dec 2, 2015

thanks, you save my time

@AssafMashiah

This comment has been minimized.

Show comment
Hide comment
@AssafMashiah

AssafMashiah Dec 28, 2015

Very nice, Thanks

AssafMashiah commented Dec 28, 2015

Very nice, Thanks

@mingbo

This comment has been minimized.

Show comment
Hide comment
@mingbo

mingbo commented Dec 30, 2015

+1 like

@DuyguA

This comment has been minimized.

Show comment
Hide comment
@DuyguA

DuyguA Jan 3, 2016

Very nice, thanks.

DuyguA commented Jan 3, 2016

Very nice, thanks.

@ArihantRk

This comment has been minimized.

Show comment
Hide comment
@ArihantRk

ArihantRk Jan 27, 2016

Very informative. Got in one place.

ArihantRk commented Jan 27, 2016

Very informative. Got in one place.

@Bbutterfly88

This comment has been minimized.

Show comment
Hide comment
@Bbutterfly88

Bbutterfly88 commented Feb 21, 2016

27843002685

@skychan

This comment has been minimized.

Show comment
Hide comment
@skychan

skychan Feb 22, 2016

cool, thx

skychan commented Feb 22, 2016

cool, thx

@Ilyes-Hammadi

This comment has been minimized.

Show comment
Hide comment
@Ilyes-Hammadi

Ilyes-Hammadi Mar 28, 2016

Cool guide thanks

Ilyes-Hammadi commented Mar 28, 2016

Cool guide thanks

@vibin

This comment has been minimized.

Show comment
Hide comment
@vibin

vibin Mar 31, 2016

Love the "reverse notation" tip!

vibin commented Mar 31, 2016

Love the "reverse notation" tip!

@ryukinix

This comment has been minimized.

Show comment
Hide comment
@ryukinix

ryukinix Apr 11, 2016

Very nice!

ryukinix commented Apr 11, 2016

Very nice!

@erichooi

This comment has been minimized.

Show comment
Hide comment
@erichooi

erichooi Jul 8, 2016

Learn a lot!

erichooi commented Jul 8, 2016

Learn a lot!

@frasxav

This comment has been minimized.

Show comment
Hide comment
@frasxav

frasxav Jul 8, 2016

Thank you

frasxav commented Jul 8, 2016

Thank you

@charlessachet

This comment has been minimized.

Show comment
Hide comment
@charlessachet

charlessachet commented Jul 15, 2016

Thanks!! +1

@vlaw

This comment has been minimized.

Show comment
Hide comment
@vlaw

vlaw commented Jul 29, 2016

+1

@akgeni

This comment has been minimized.

Show comment
Hide comment
@akgeni

akgeni Sep 26, 2016

Must have these rules by side, Thank You.

akgeni commented Sep 26, 2016

Must have these rules by side, Thank You.

@stinkymonkeyph

This comment has been minimized.

Show comment
Hide comment
@stinkymonkeyph

stinkymonkeyph Oct 5, 2016

truly godsend guide for a beginner in python. kudos man

stinkymonkeyph commented Oct 5, 2016

truly godsend guide for a beginner in python. kudos man

@arvindpdmn

This comment has been minimized.

Show comment
Hide comment
@arvindpdmn

arvindpdmn Oct 6, 2016

Anybody can fix anything? Taken out of context it's misleading. Khan Academy says:

We don’t have strict artificial boundaries between our teams or codebases. Nobody is forbidden from fixing what they think needs fixing, regardless of team or specialization.

arvindpdmn commented Oct 6, 2016

Anybody can fix anything? Taken out of context it's misleading. Khan Academy says:

We don’t have strict artificial boundaries between our teams or codebases. Nobody is forbidden from fixing what they think needs fixing, regardless of team or specialization.

@heyost

This comment has been minimized.

Show comment
Hide comment
@heyost

heyost commented Jan 4, 2017

+1

@Denkneb

This comment has been minimized.

Show comment
Hide comment
@Denkneb

Denkneb commented Feb 20, 2017

Cool

@WebVoid

This comment has been minimized.

Show comment
Hide comment
@WebVoid

WebVoid Mar 15, 2017

+1, but I agree with julie777 on the reverse notation point

WebVoid commented Mar 15, 2017

+1, but I agree with julie777 on the reverse notation point

@aomaryus

This comment has been minimized.

Show comment
Hide comment
@aomaryus

aomaryus Mar 18, 2017

Good
Not sure about reverse notation

aomaryus commented Mar 18, 2017

Good
Not sure about reverse notation

@felixzhooou

This comment has been minimized.

Show comment
Hide comment
@felixzhooou

felixzhooou Apr 14, 2017

Cool guide. Thanks.

felixzhooou commented Apr 14, 2017

Cool guide. Thanks.

@moacirmoda

This comment has been minimized.

Show comment
Hide comment
@moacirmoda

moacirmoda commented Apr 26, 2017

+1

@usptact

This comment has been minimized.

Show comment
Hide comment
@usptact

usptact Apr 27, 2017

Great guide but I still prefer tabs to 4 spaces! Modern editors are sophisticated enough to convert them to spaces and show lines of codes appropriately.

usptact commented Apr 27, 2017

Great guide but I still prefer tabs to 4 spaces! Modern editors are sophisticated enough to convert them to spaces and show lines of codes appropriately.

@oxydron

This comment has been minimized.

Show comment
Hide comment
@oxydron

oxydron Jun 6, 2017

Indentation

Use 4 spaces--never tabs. Enough said.

The only nope for me.

oxydron commented Jun 6, 2017

Indentation

Use 4 spaces--never tabs. Enough said.

The only nope for me.

@arunreddy

This comment has been minimized.

Show comment
Hide comment
@arunreddy

arunreddy Jun 28, 2017

Great guide. Thanks.

arunreddy commented Jun 28, 2017

Great guide. Thanks.

@pdbure15

This comment has been minimized.

Show comment
Hide comment
@pdbure15

pdbure15 Jul 27, 2017

Good tips!!

pdbure15 commented Jul 27, 2017

Good tips!!

@dermatologist

This comment has been minimized.

Show comment
Hide comment
@dermatologist

dermatologist commented Aug 4, 2017

+1

@atharvagabhe

This comment has been minimized.

Show comment
Hide comment
@atharvagabhe

atharvagabhe Sep 16, 2017

Such amaze. Many claps!

atharvagabhe commented Sep 16, 2017

Such amaze. Many claps!

@johnyf

This comment has been minimized.

Show comment
Hide comment
@johnyf

johnyf commented Sep 29, 2017

I would like to recommend this one-line change: https://gist.github.com/johnyf/129904f37352cd7bd4d464bed924b84e/revisions

@Hacktivista

This comment has been minimized.

Show comment
Hide comment
@Hacktivista

Hacktivista commented Oct 11, 2017

Like it :)

@TheML9I

This comment has been minimized.

Show comment
Hide comment
@TheML9I

TheML9I Oct 30, 2017

Not sure about Avoid getter and setter methods.

Setter makes a sense to use, but in the example, it seems like with Unit Test explanation 1+1. In more complicated cases it might be considered like good practice.

TheML9I commented Oct 30, 2017

Not sure about Avoid getter and setter methods.

Setter makes a sense to use, but in the example, it seems like with Unit Test explanation 1+1. In more complicated cases it might be considered like good practice.

@banjin

This comment has been minimized.

Show comment
Hide comment
@banjin

banjin commented Nov 2, 2017

good

@dronni3de

This comment has been minimized.

Show comment
Hide comment
@dronni3de

dronni3de Nov 9, 2017

Thank you very much!

dronni3de commented Nov 9, 2017

Thank you very much!

@uduse

This comment has been minimized.

Show comment
Hide comment
@uduse

uduse Nov 28, 2017

@julie777 totally agree, reverse notation is so mind-twisting to read!

uduse commented Nov 28, 2017

@julie777 totally agree, reverse notation is so mind-twisting to read!

@jkryanchou

This comment has been minimized.

Show comment
Hide comment
@jkryanchou

jkryanchou Jan 12, 2018

awesome Guide 👍

jkryanchou commented Jan 12, 2018

awesome Guide 👍

@amirouche

This comment has been minimized.

Show comment
Hide comment
@amirouche

amirouche Jan 17, 2018

By the present comment, I testify I read the whole page and can tell it's good guide.

amirouche commented Jan 17, 2018

By the present comment, I testify I read the whole page and can tell it's good guide.

@atrevino

This comment has been minimized.

Show comment
Hide comment
@atrevino

atrevino Jan 22, 2018

Nice one !

atrevino commented Jan 22, 2018

Nice one !

@subhanshuja

This comment has been minimized.

Show comment
Hide comment
@subhanshuja

subhanshuja commented Jan 31, 2018

awesome

@jgbell100

This comment has been minimized.

Show comment
Hide comment
@jgbell100

jgbell100 Feb 3, 2018

excellent - really useful.

jgbell100 commented Feb 3, 2018

excellent - really useful.

@viprai91

This comment has been minimized.

Show comment
Hide comment
@viprai91

viprai91 commented Feb 14, 2018

Awesome!

@JoseLGP

This comment has been minimized.

Show comment
Hide comment
@JoseLGP

JoseLGP Feb 22, 2018

When I started to develop for real world, the first thing I looked for was this guide. Thank you very much!

JoseLGP commented Feb 22, 2018

When I started to develop for real world, the first thing I looked for was this guide. Thank you very much!

@VictorSouzas

This comment has been minimized.

Show comment
Hide comment
@VictorSouzas

VictorSouzas Feb 27, 2018

Great post 👍

VictorSouzas commented Feb 27, 2018

Great post 👍

@pherrusa7

This comment has been minimized.

Show comment
Hide comment
@pherrusa7

pherrusa7 Mar 7, 2018

Very clear, thanks!

pherrusa7 commented Mar 7, 2018

Very clear, thanks!

@collinforsyth

This comment has been minimized.

Show comment
Hide comment
@collinforsyth

collinforsyth Mar 15, 2018

Simple, to the point. Going to try and frame this for team members.

collinforsyth commented Mar 15, 2018

Simple, to the point. Going to try and frame this for team members.

@WittmannF

This comment has been minimized.

Show comment
Hide comment
@WittmannF

WittmannF Apr 12, 2018

Thank you!

WittmannF commented Apr 12, 2018

Thank you!

@The-Gupta

This comment has been minimized.

Show comment
Hide comment
@The-Gupta

The-Gupta Apr 14, 2018

@sloria Update the link Python Best Practice Patterns [https://www.youtube.com/watch?v=GZNUfkVIHAY]

The-Gupta commented Apr 14, 2018

@sloria Update the link Python Best Practice Patterns [https://www.youtube.com/watch?v=GZNUfkVIHAY]

@crustafari

This comment has been minimized.

Show comment
Hide comment
@crustafari

crustafari Apr 29, 2018

Sweet! Thank you!

crustafari commented Apr 29, 2018

Sweet! Thank you!

@leobarcellos

This comment has been minimized.

Show comment
Hide comment
@leobarcellos

leobarcellos commented May 11, 2018

Nice. <3

@ibtehaz-shawon

This comment has been minimized.

Show comment
Hide comment
@ibtehaz-shawon

ibtehaz-shawon commented Jun 4, 2018

sweeet <3 <3

@marioishikawa

This comment has been minimized.

Show comment
Hide comment
@marioishikawa

marioishikawa Jun 6, 2018

Simple and efficient. Great job!

marioishikawa commented Jun 6, 2018

Simple and efficient. Great job!

@berkaykirmizioglu

This comment has been minimized.

Show comment
Hide comment
@berkaykirmizioglu

berkaykirmizioglu Jun 13, 2018

Amazing guide! Thanks a lot

berkaykirmizioglu commented Jun 13, 2018

Amazing guide! Thanks a lot

@epogrebnyak

This comment has been minimized.

Show comment
Hide comment
@epogrebnyak

epogrebnyak Jun 15, 2018

Great reference! I could only wish Google Python Style Guide was among references too. Also I like this best practice list.

epogrebnyak commented Jun 15, 2018

Great reference! I could only wish Google Python Style Guide was among references too. Also I like this best practice list.

@joelfranco

This comment has been minimized.

Show comment
Hide comment
@joelfranco

joelfranco commented Jun 26, 2018

+1

@akashjobanputra

This comment has been minimized.

Show comment
Hide comment
@akashjobanputra

akashjobanputra commented Jul 9, 2018

+1

@TimeTraveller-San

This comment has been minimized.

Show comment
Hide comment
@TimeTraveller-San

TimeTraveller-San Jul 16, 2018

Great guide but i don't agree with using spaces over tabs. We're in 2018.

TimeTraveller-San commented Jul 16, 2018

Great guide but i don't agree with using spaces over tabs. We're in 2018.

@ABODFTW

This comment has been minimized.

Show comment
Hide comment
@ABODFTW

ABODFTW Jul 17, 2018

Thanks a lot very helpful.

ABODFTW commented Jul 17, 2018

Thanks a lot very helpful.

@urmilshroff

This comment has been minimized.

Show comment
Hide comment
@urmilshroff

urmilshroff commented Jul 23, 2018

Thanks!

@rvfischione

This comment has been minimized.

Show comment
Hide comment
@rvfischione

rvfischione Jul 26, 2018

@TimeTraveller-San Mixed tab and space use is awful, and it hasn't gone away just because it's 2018 (let alone the OP year 2013). Many IDEs let the user insert four spaces when hitting the tab key: one setting change away from never thinking about it again.

rvfischione commented Jul 26, 2018

@TimeTraveller-San Mixed tab and space use is awful, and it hasn't gone away just because it's 2018 (let alone the OP year 2013). Many IDEs let the user insert four spaces when hitting the tab key: one setting change away from never thinking about it again.

@ericksprengel

This comment has been minimized.

Show comment
Hide comment
@ericksprengel

ericksprengel Aug 1, 2018

2 spaces >> 4 spaces >> tabs
hahaha

ericksprengel commented Aug 1, 2018

2 spaces >> 4 spaces >> tabs
hahaha

@chakgou

This comment has been minimized.

Show comment
Hide comment
@chakgou

chakgou commented Aug 2, 2018

nice

@claytonrm

This comment has been minimized.

Show comment
Hide comment
@claytonrm

claytonrm commented Aug 15, 2018

nice!!

@nilerbarcelos

This comment has been minimized.

Show comment
Hide comment
@nilerbarcelos

nilerbarcelos commented Sep 4, 2018

+1

@thiagodiogo

This comment has been minimized.

Show comment
Hide comment
@thiagodiogo

thiagodiogo commented Sep 5, 2018

+1

@pepoluan

This comment has been minimized.

Show comment
Hide comment
@pepoluan

pepoluan Sep 5, 2018

Put all imports at the top of the page with three sections, each separated by a blank line

Heh, I've been doing this for years without codifying it. I thought it's already a Best Practice?

pepoluan commented Sep 5, 2018

Put all imports at the top of the page with three sections, each separated by a blank line

Heh, I've been doing this for years without codifying it. I thought it's already a Best Practice?

@VishwaasHegde

This comment has been minimized.

Show comment
Hide comment
@VishwaasHegde

VishwaasHegde Sep 27, 2018

Thanks, Also, avoiding getter and setter is something we never do in Java however, didnt know this was a good practice in python. :)

VishwaasHegde commented Sep 27, 2018

Thanks, Also, avoiding getter and setter is something we never do in Java however, didnt know this was a good practice in python. :)

@chakgou

This comment has been minimized.

Show comment
Hide comment
@chakgou

chakgou commented Oct 1, 2018

cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment