views:

201

answers:

6

While coding in Python it's better to code by following the guidelines of PEP8.

And while coding for Symbian it's better to follow its coding standards.

But when I code for PyS60 which guidelines should I follow? Till now I have been following PEP8, but this code shows the opposite. Do I need to rework my code?

+1  A: 

Use the style of the API(s) you're interfacing the most. That's a simple rule that works in most places (where you can see the code, i.e. Java/C# is a bit hard(er).. :)

Marcus Lindblom
A: 

Standards are wonderful; everybody should have 2 or 3 :)

Karl
+2  A: 

"Do I need to rework my code?"

Does it add value to rework you code?

How many folks will help you develop code who

A) don't know PEP 8

B) only know PyS60 coding standards because that's the only code they've ever seen.

and

C) cannot be taught anything different than the PyS60 coding standards?

List all the people who you'll work with that meet all three criteria. Then decide which is cheaper: rework your code or fire them.

S.Lott
+2  A: 

I don't see anything in your code sample that is obviously bogus. It's not the style I'd use, but neither is it hard to read, and it's not so far from PEP8 that I'd call it “the opposite”.

PEP8 shouldn't be seen as hard-and-fast law to which all code must conform, character by rigid character. It is a baseline for readable Python. When you go a little bit Java-programmer and get that antsiness about making the spacing around every operator consistent, go back and read the start of PEP8 again. The bit with the hobgoblin.

Don't get hung up on lengthy ‘reworking’ of code that is functional, readable, and at least in the same general vicinity as PEP8.

bobince
A: 

i'd say use PEP8, but as mentioned above, don't get too hung up on it. when coding IN symbian c++ you should use symbian coding standards, but not necessarily if your program is merely running on the platform. don't get confused between symbian the OS and symbian c++ the (psuedo) language.

A: 

Your example code is just that person's personal style. It's NOT following official PyS60 coding convension, there is no such a thing! Write whatever style gives you the best results.

Having said that I would recommend using PEP8, but only if you plan to use pylint to give you some additional confidence in your project.

I've done nothing but PyS60 stuff, never real python. Used pylint to speedup development time and to automatically point me some potential defects before I run into them in real life.

JOM