On Thu, Feb 19, 2015 at 9:23 AM, rakesh sharma
<[email protected]> wrote:
> Greetings !!
> Hi all,
> what the meaning of the line at the start of the python file
> __author__ = "user"


Hi Rakesh,


It's assigning a variable '__author__' with the value "user".

Python libraries typically have some kind of "metadata" that talks
about the library, and one way to express this metadata is to assign
to certain variables like what you're seeing here.


I can look at a particular module, and see if it has an '__author__':

########################################
>>> import tarfile
>>> tarfile.__author__
'Lars Gust\xe4bel ([email protected])'

>>> import io
>>> io.__author__
"Guido van Rossum <[email protected]>, Mike Verdone
<[email protected]>, Mark Russell <[email protected]>,
Antoine Pitrou <[email protected]>, Amaury Forgeot d'Arc
<[email protected]>, Benjamin Peterson <[email protected]>"
########################################

That being said, it's not a requirement, so not all library modules have this.

########################################
>>> import xml
>>> xml.__author__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__author__'
########################################


And as a beginner, you probably don't need to worry about assigning
authorship to your own programs: you should know that you wrote them.
:P

When you start working with larger teams of people, it's helpful
because you want to direct development questions to the folks who own
those files.  Authorship is a rough approximation to find the right
person in charge.
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to