Idea for alternative use for @

P

Paul McGuire

I was just reading over Mark Lutz's excellent article on OnLamp, titled
"When Pythons Attack -
Common Mistakes of Python Programmers"
(http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html). One of
the common pitfalls he cites is the mixing of spaces and tabs, and how this
is not always reliable since tabs can be handled differently in different
platforms and editors.

I thought it might be useful to include some sort of compiler directive like
a C++ pragma to represent this kind of compile-time meta information. And
it struck me that '@' would be an excellent marker for such a statement,
something like:
@tabsize 8

It clearly marks the statement as some sort of non-Python information. It
could be used for any number of compiler information items, such as module
include paths, macro definitions, debug levels, command switches, version
limitations (@min_version 2.3.4).

I guess this still does not address the conflict with tools such as Leo that
already use '@' for internal code markup purposes, tho. I know '$' is also
available, but '@' just looks better to me for this purpose.

-- Paul

Vote for J2. Keep Python Beautiful.
 
B

Bernhard Herzog

Paul McGuire said:
I thought it might be useful to include some sort of compiler directive like
a C++ pragma to represent this kind of compile-time meta information. And
it struck me that '@' would be an excellent marker for such a statement,
something like:
@tabsize 8

FWIW, that particular directive already exists. To set the tab width to
4 you can do either

# :ts=4

or if you prefer emacs style:

# tab-width:4

It's an undocumented (mis-)feature of CPython, though, IIRC.

Bernhard
 
C

Colin J. Williams

Bernhard said:
FWIW, that particular directive already exists. To set the tab width to
4 you can do either

# :ts=4

or if you prefer emacs style:

# tab-width:4

It's an undocumented (mis-)feature of CPython, though, IIRC.

Bernhard
tabs are a pain. The recommended approach is to replace them with spaces.

Colin W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top