[Patch] {l,r}just with optional pad character parameter

Moshe Zadka moshez at math.huji.ac.il
Mon Jul 17 17:30:49 EDT 2000


On Mon, 17 Jul 2000, Peter Schneider-Kamp wrote:

> Thomas Wouters wrote:
> > 
> > As for the patch itself, it looks okay, though I'd say the restriction on
> > padchar being a single character is a bit strange. Why not allow multiple
> > characters as padding ? string.join() allows strings instead of single
> > characters, too.
> 
> Two reasons why not:
> - it would have been harder to implement <wink>
> - undetermined semantics:
>   "GvR".ljust(6,"12") =?= "GvR121"
>   or
>   "GvR".ljust(6,"12") =?= "GvR12"
>   or
>   "GvR".ljust(6,"12") =?= "GvR1212"

In the face of ambiguity, refuse the temptation to guess!!!!!

"GvR".ljust(6, "12")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: second argument to ljust must be of length 1

--
Moshe Zadka <moshez at math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez





More information about the Python-list mailing list