[Tutor] ".=" in Python ?

Michael Janssen Janssen@rz.uni-frankfurt.de
Mon May 5 18:38:02 2003


On Tue, 6 May 2003, Tadahiko 'kiko' Uehara wrote:

>
> Hi all,
> I just start learning Python as my (almost) first programming language.

Hello Tadahiko!

> text = "servername = "
> modLine = "" # <-- had to add this line,in order to *1 to work.
>
> f = open("/home/kiko/docs/serverList")
> line = f.readline()
> while line:
>     modLine = modLine + text + line	# *1
>     line = f.readline()

even if you use python's "+=" you need to write 'modLine = ""' first.
'modLine += text' would assume that modLine is already defined. This might
be strictly necessary with python's type of typing (combined with the
"refusal to guess in the face of ambiguity") or just a mater of "Explicit
is better than implicit". Do an "import this" to get more of python's
tellings :-)

>
> f.close()
>
> print modLine
> ------------------------------------
>
>  Also, If this mailing-list is active anymore? I checked list archives
> http://mail.python.org/pipermail/tutor/ But i only see 1-2 posts per
> recent month ..!?

tutor absolutly meets my opionion of a active list (as you should have
already expirienced ;-). You possibly have seen those rediculess "far in
future posts" (mostly due to a very badly adjustet system clock - but how
knows, maybe those guys have a time machine indeed? ;-). Make shure you
request the archives for recent months.

Michael

>
> Thanks in advance,
> -kiko
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>