A Byte of Python 1.92 by Swaroop C. H. PDF

By Swaroop C. H.

Show description

Read or Download A Byte of Python 1.92 PDF

Best programming: programming languages books

Download PDF by Matthias Geirhos : Professionell entwickeln mit Visual C# 2010

Эта энциклопедия будет интересна в первую очередь современным охотникам, любителям стрельбы по тарелочкам и коллекционерам. Написанная специалистом по оружию, она может служить справочным пособием для всех любителей охотничьего оружия.

Extra resources for A Byte of Python 1.92

Sample text

Getcwd()) to find out the current directory of your program. pyc files Importing a module is a relatively costly affair, so Python does some tricks to make it faster. ). pyc file is useful when you import the module the next time from a different program - it will be much faster since a portion of the processing required in importing a module is already done. Also, these byte-compiled files are platform-independent. py files. pyc files will not be created. statement If you want to directly import the argv variable into your program (to avoid typing the sys.

Then the second line is blank followed by any detailed explanation starting from the third line. You are strongly advised to follow this convention for all your docstrings for all your non-trivial functions. We can access the docstring of the printMax function using the __doc__ (notice the double underscores) attribute (name belonging to) of the function. Just remember that Python treats everything as an object and this includes functions. We'll learn more about objects in the chapter on classes.

We'll learn more about objects in the chapter on classes. If you have used help() in Python, then you have already seen the usage of docstrings! What it does is just fetch the __doc__ attribute of that function and displays it in a neat manner for you. You can try it out on the function above - just include help(printMax) in 53 Python en:Functions your program. Remember to press the q key to exit help. Automated tools can retrieve the documentation from your program in this manner. Therefore, I strongly recommend that you use docstrings for any non-trivial function that you write.

Download PDF sample

A Byte of Python 1.92 by Swaroop C. H.

by Robert

Rated 4.82 of 5 – based on 3 votes