Perl is worse!
Ben Wolfson
rumjuggler at cryptarchy.org
Sat Jul 29 00:02:31 EDT 2000
On Fri, 28 Jul 2000 23:02:52 GMT, grey at despair.rpglink.com (Steve Lamb)
wrote:
>On Fri, 28 Jul 2000 23:09:56 +0200, Alex Martelli <alex at magenta.com> wrote:
>>I hope you remember that in Python there's no need for the joining
>>and later re-splitting: just putting the pair (tuple) in there is
>>so much easier and more natural.
>
> No. I am learning that. A plesant side effect of this excellent
>discussion.
>
>>Among other things, it makes it easy to save/load/change a format-string;
>
> Nono, you misunderstand me. I prefer the Pascal notion of variables in
>place in the string with formatting attached to it instead of placeholder
>formatting strings with the variables hanging off the end of the string.
>Pseudo code from no language, bear with me.
>
>"Here is a string with ",$a:d:0:0," variable in it."
>
>"Here is a string with %d:0:0 variable in it.",$a
>
> In the former I read and I see, "Oh, $a goes here with this formatting"
>whereas in the latter it is "Oh, here is the formatting for... uhm.. $a."
>
> Again, simplistic and not in any language, but taken to the extreme you
>can see the problem.
>
>"%d:0:0 %c:U %s %s %s %s %d %s %s %s \
>%d:0:0!",$a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k
>
> What variable goes with what again?
Hmmm... An example of why I think I would prefer format strings over
in-place variables is that format strings seem more powerful to me.
the code below seems like a rather clear and easy way of doing something
which would be more difficult using in-place variables.
return '%r, %s%s ' % (self.name, self.firstline, ', %s'*len(self.entries) \
% tuple(map(None, namestofields[self.name][FIELDS], self.entries)))
--
Barnabas T. Rumjuggler
My pants! They have come
To rescue me! No, it is
Only a squirrel.
-- Not Zelgadis, not on ark
More information about the Python-list
mailing list