There's a lot of dumb stuff out there. "Algorithms should be coded
efficiently ..." Thanks, I'll keep that in mind.
van Rossum's guidelines tend toward "pick something and stick to it"
which is OK if you have enough experience to pick something Pythonic.
I'm a relative newbie, not qualified to pick.
Anything written somewhere that's thorough? Any code body that should
serve as a reference? 13 1074
2008/1/7, Ma************@ gmail.com <Ma************ @gmail.com>:
There's a lot of dumb stuff out there. "Algorithms should be coded
efficiently ..." Thanks, I'll keep that in mind.
van Rossum's guidelines tend toward "pick something and stick to it"
which is OK if you have enough experience to pick something Pythonic.
I'm a relative newbie, not qualified to pick.
Anything written somewhere that's thorough? Any code body that should
serve as a reference?
PEP 8 http://www.python.org/dev/peps/pep-0008/
-- http://mail.python.org/mailman/listinfo/python-list
--
-- Guilherme H. Polo Goncalves
Thank you both.
Stupid me, went to Python.org and found Style Guidelines and thought
that was the last word. Oh well.
PEP 8 reminds me a lot of Sun's Java conventions, in ways I wish it
didn't. The overall structure seems like a random list of topics and
it omits a lot. For Java I went from Sun to other conventions to try
to compile a meta-convention ( http://www.MartinRinehart.com/articl...nventions.html
).
Here's just one of my questions:
foo = [
'some item, quite long',
'more items, all demanding there own line as they are not short',
...
Where would you put the closing ']'? Ma************@ gmail.com wrote:
Here's just one of my questions:
foo = [
'some item, quite long',
'more items, all demanding there own line as they are not short',
...
Where would you put the closing ']'?
on a line by itself, indented as your favourite Python editor indents it.
</F>
2008/1/7, Ma************@ gmail.com <Ma************ @gmail.com>:
Thank you both.
Stupid me, went to Python.org and found Style Guidelines and thought
that was the last word. Oh well.
PEP 8 reminds me a lot of Sun's Java conventions, in ways I wish it
didn't. The overall structure seems like a random list of topics and
it omits a lot. For Java I went from Sun to other conventions to try
to compile a meta-convention ( http://www.MartinRinehart.com/articl...nventions.html
).
Here's just one of my questions:
foo = [
'some item, quite long',
'more items, all demanding there own line as they are not short',
...
Where would you put the closing ']'?
I would put ']' at a new line:
foo = [
'too long',
'too long too',
...
]
I don't really believe it should exist style guidelines for everything
that is possible (or if it did I doubt it would matter), many/most
people adapt the guidelines to fetch their own style. That is not
really a problem if you are consistent during all the code, and if it
is not too ugly as well =)
-- http://mail.python.org/mailman/listinfo/python-list
--
-- Guilherme H. Polo Goncalves
Guilherme Polo wrote:
foo = [
'too long',
'too long too',
...
]
OK, I'll put it there too, and it will be easy for us to read each
other's code (at least in this particular).
ajaksu <aj****@gmail.c omwrites:
I've done this search before and it was very interesting, doing it
again gave me new results that also seem valuable. Here's most of
them (where PCG = Python Coding Guidelines).
Thanks, this is an awesome list. It's good to have a variety of real
examples when drafting a coding standard for a project.
Do you think this could be a valuable addition to the Python wiki?
Definitely!
--
\ "The most merciful thing in the world... is the inability of |
`\ the human mind to correlate all its contents." -- Howard |
_o__) Philips Lovecraft |
Ben Finney
On 1/7/08, Guilherme Polo <gg****@gmail.c omwrote:
2008/1/7, Ma************@ gmail.com <Ma************ @gmail.com>:
Anything written somewhere that's thorough? Any code body that should
serve as a reference?
PEP 8 http://www.python.org/dev/peps/pep-0008/
The problem with PEP 8 is that even code in the standard libraries
doesn't follow the recommendations regarding the naming of functions
for example. The recommendation is to_separate_wor ds_with_undersc ore,
but some code uses lowerCamelCase instead.
I tended to dislike the underscore convention, but after forcing
myself to use it for a while I'm starting to appreciate its beauty.
-- ma****@librador .com http://www.librador.com
Martin Vilcans wrote:
On 1/7/08, Guilherme Polo <gg****@gmail.c omwrote:
>2008/1/7, Ma************@ gmail.com <Ma************ @gmail.com>:
>>Anything written somewhere that's thorough? Any code body that should serve as a reference?
PEP 8 http://www.python.org/dev/peps/pep-0008/
The problem with PEP 8 is that even code in the standard libraries
doesn't follow the recommendations regarding the naming of functions
for example. The recommendation is to_separate_wor ds_with_undersc ore,
but some code uses lowerCamelCase instead.
I tended to dislike the underscore convention, but after forcing
myself to use it for a while I'm starting to appreciate its beauty.
I've come to like lowerCamelCase and a
tab of 2.
A tab of 4 wastes more space than is
needed for the occasional heavy
indenting.
Colin W. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: beliavsky |
last post by:
Is there a more recent set of Python style guidelines than PEP 8,
"Style Guide for Python Code", by van Rossum and Warsaw, at
http://www.python.org/peps/pep-0008.html , which is dated July 5,
2001?
|
by: Richard James |
last post by:
Are we looking at the scripting world through Python colored glasses?
Has Python development been sleeping while the world of scripting
languages has passed us Pythonista's by?
On Saturday Slashdot ran this article on the "best" scripting
languages.
http://developers.slashdot.org/developers/04/06/12/2125229.shtml?tid=126&tid=156
"Folks at the Scriptometer conducted a practical survey of which
scripting language is the best. While...
|
by: jamilur_rahman |
last post by:
What is the BIG difference between checking the "if(expression)" in A
and B ? I'm used to with style A, "if(0==a)", but my peer reviewer
likes style B, how can I defend myself to stay with style A ?
style A:
....
....
int a = 1;
if(0==a)
{
|
by: seb.haase |
last post by:
Hi,
Is it true that that "Python 3000" is dead ?
Honestly I think that e.g. changing 5/2 to be 2.5 (instead of 2) would
just break to much code :-(
On the otherhand I'm using Python as "Matlab replacement" and would
generally like 5/2 ==2.5
So, I was contemplating to default all my modules/scripts to start with
"from __future__ import division"
but if it is never coming (in this decade, that is) then it would be a
|
by: Steve Howell |
last post by:
I've always thought that the best way to introduce new
programmers to Python is to show them small code
examples.
When you go to the tutorial, though, you have to wade
through quite a bit of English before seeing any
Python examples.
Below is my attempt at generating ten fairly simple,
representative Python programs that expose new users
| |
by: Alexnb |
last post by:
This is similar to my last post, but a little different. Here is what I would
like to do.
Lets say I have a text file. The contents look like this, only there is A
LOT of the same thing.
() A registry mark given by underwriters (as at Lloyd's) to ships in
first-class condition. Inferior grades are indicated by A 2 and A 3.
() The first three letters of the alphabet, used for the whole alphabet.
() In church or chapel style; -- said of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |