On Thu, Feb 19, 2015 at 9:23 AM, rakesh sharma
<rakeshsharm...@hotmail.com> 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 (l...@gustaebel.de)'

>>> import io
>>> io.__author__
"Guido van Rossum <gu...@python.org>, Mike Verdone
<mike.verd...@gmail.com>, Mark Russell <mark.russ...@zen.co.uk>,
Antoine Pitrou <solip...@pitrou.net>, Amaury Forgeot d'Arc
<amaur...@gmail.com>, Benjamin Peterson <benja...@python.org>"
########################################

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  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to