Why do some attributes start with '@' while others done't?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 22 15:00:11 PST 2016


On Fri, Jan 22, 2016 at 10:11:45PM +0000, Ola Fosheim Grøstad via Digitalmars-d wrote:
> On Friday, 22 January 2016 at 19:10:38 UTC, H. S. Teoh wrote:
> >I work with Python code without an IDE, and I manage just fine. As
> >long as you're consistent with how you use tabs vs. spaces, it's not
> >a problem.
> 
> Yes, if you use the same editor and reformat source files you download
> before editing them. I have found it to be more convenient to use an
> editor that auto detects common mistakes (not unique for Python
> though).

Why do you need to reformat source files you download? Just follow the
formatting conventions of the surrounding code and you'll save yourself
a whole lot of headache.  After all, style is but the most trivial of
issues in programming, and the least relevant when it comes to getting
the job done -- even if it's not your personal preference.


> >People who complain about Python's "whitespace thing" tend to be
> >people who write unreadable code in the first place; that's no
> >surprise.
> 
> Yes, I don't think it takes more time to get used to that than to get
> used to braces, but if you nest longer functions within functions it
> is possible to accidentally have a mis-indented ending. Not a frequent
> problem, though.  Happens with braces too.

Once a piece of code grows past a certain length, and especially past a
certain level of indentation, that's a hint that it's time to refactor.
;-)


T

-- 
In a world without fences, who needs Windows and Gates? -- Christian Surchi


More information about the Digitalmars-d mailing list