newb comment request

Alexandre ac007 at bluewin.ch
Thu Nov 27 16:23:50 CET 2003


"Peter Otten" <__peter__ at web.de> a écrit dans le message de news:bq4eo0$fho$03$1 at news.t-online.com...
> I would suggest that you repost the script without the excessive comments.
> Most programmers find Python very readable, your comments actually make it
> harder to parse for the human eye.

Done, so your help will also make my next posts better :)

> Also, make it work if you can, or point to the actual errors that you cannot
> fix yourself. Provide actual test data in your post instead of the
> unpickling code, so that others can easily reproduce your errors.
> Only then you should ask for improvements.

Also available in my new version :)

> Random remarks:
>
> Object oriented programming is about programming against interfaces, so
> exessive type checking is a strong hint to design errors.

I'm not sure i understand... well, let's put it that way : i'm sure i don't understand :)
I guess i'll have to read about OO design... this is my first program, although i think i understand what OO means, i'm
not abble to write OO yet :/

> Avoid using global variables in your functions; rather pass them explicitly
> as arguments.

I'll try that !

> Where is valuesD introduced?

Not sure i understand the question... i used this variable name "ValuesD" (meaning Values from Data) not to conflict
with the other variable named "values" in the same function.

> "%s" % str(1.23)
> is the same as
> "%s" % 1.23

Ok


> type(value) is not types.NoneType
> is the same as
> value is not None

Shame on me :)

> Module level code is habitually wrapped like so:
>
> if __name__ == "__main__":
>     infile = open('cached-objects-Python-pickled-sample', 'rb')
>     _data = pickle.load(infile)
>     infile.close()
>     # process _data...
>
> That way, you can import the module as well as use it as a standalone
> script.

Oh ? but, i can use it as standalone script ?!
If i type myScriptName.py in my dos prompt the script is working !

> I'm sure, there is more, but then again, clean up the comments, try to make
> it work, and then repost.

I'm sure there's more :)
Thanks a lot for your comments Peter !
Best regards,
Alexandre






More information about the Python-list mailing list