Programming Tutorials

Python Tutorials

31. call by reference in python

By: Python Team : 2012-04-07

Description: Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there's no alias between an argument name in the caller and callee, and so no call-by-reference per se. You can achieve the desired effect in a number of ways.


32. UnboundLocalError in python

By: Python Documentation Team : 2012-04-07

Description: It can be a surprise to get the UnboundLocalError in previously working code when it is modified by adding an assignment statement somewhere in the body of a function.


33. How to force rereading of a changed module in python

By: Python Team : 2012-04-07

Description: For reasons of efficiency as well as consistency, Python only reads the module file on the first time a module is imported. If it didn't, in a program consisting of many modules where each one imports the same basic module, the basic module would be parsed and re-parsed many times. To force rereading of a changed module, do this


34. How to find the current module name in python

By: Python Team : 2012-04-07

Description: module can find out its own module name by looking at the predefined global variable __name__. If this has the value '__main__', the program is running as a script. Many modules that are usually used by importing them also provide a command-line interface or a self-test, and only execute this code after checking __name__:


35. How to compile python script and create .pyc file?

By: Python Documentation Team : 2012-04-07

Description: When a module is imported for the first time (or when the source is more recent than the current compiled file) a .pyc file containing the compiled code should be created in the same directory as the .py file.


36. What is the need for Python language?

By: Guido van Rossum : 2012-04-07

Description: I had extensive experience with implementing an interpreted language in the ABC group at CWI, and from working with this group I had learned a lot about language design. This is the origin of many Python features, including the use of indentation for statement grouping and the inclusion of very-high-level data types (although the details are all different in Python).


37. error: _mysql_ConnectionObject has no member named

By: Emiley J : 2012-03-16

Description: While trying to install mysql-python using easy_install you get this error. It means you have not installed mysql-devel in your system. To resolve this, install mysql-devel first and then install mysql-python.


38. Unknown command: 'migrate'

By: Emiley J : 2012-03-16

Description: If you are getting this error, it means you don't have 'south' installed and you are trying to execute from one of your python files. To resolve this error, obviously you need to install south.


39. Using Unicode Literals in Python

By: Guido : 2011-04-08

Description: In Python source code, specific Unicode code points can be written using the \u escape sequence, which is followed by four hex digits giving the code point. The \U escape sequence is similar, but expects eight hex digits, not four:


40. Installing gedit for python programming in Windows

By: zhmark : 2011-03-04

Description: Here is a step by step guide for setting up the development environment for developing programs in python for Windows. gedit is the chosen text editor of choice to keep it simple.