Yet more coding style, this time in the Python API...

_Continued lines_

In tuxapi_class.py, there are lots of continued lines indented (or
rather, *not* intended) like the following:

        # create and insert a frame to match
        data_to_match = (SOURCE_TUX,SS_DEFAULT,DATA_TP_RSP,\
        SUBDATA_TP_STATUS,DATA_STATUS,DATA_VALUE,0,0,0,0,0,\
        0,0,0,0,0)
        data_to_match_list.append(data_to_match)

Readability is very bad, and this is against the Python coding
style[1] pointed to by tuxisalive[2]:

    « The preferred way of wrapping long lines is by using Python's
    implied line continuation inside parentheses, brackets and braces.
    If necessary, you can add an extra pair of parentheses around an
    expression, but sometimes using a backslash looks better. *Make
    sure to indent the continued line appropriately*. »

So the code snippet above should be written like this:

        # create and insert a frame to match
        data_to_match = (SOURCE_TUX,SS_DEFAULT,DATA_TP_RSP, \
            SUBDATA_TP_STATUS,DATA_STATUS,DATA_VALUE,0,0,0,0,0, \
            0,0,0,0,0)
        data_to_match_list.append(data_to_match)


_Private methods and variables_

In tuxapi_class.py again, class TUXcmd has a big doc string listing all
functions available to the users of the class. This is not necessary
as the list can be found out using dir().

Some methods have a doc string saying "Not a user function". Their
name should start with "__" (double underscore) to make them really
private, which also makes such doc strings useless.

        Damien

[1] http://www.python.org/dev/peps/pep-0008/
[2] 
http://www.tuxisalive.com/documentation/how-to/guidelines-for-creating-and-packaging-an-application

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user

Reply via email to