A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-May/065189.html below:

[Python-Dev] A Horrible Inconsistency

[Python-Dev] A Horrible Inconsistency [Python-Dev] A Horrible InconsistencyGeorg Brandl g.brandl at gmx.net
Thu May 25 23:45:00 CEST 2006
Tim Peters wrote:
> [Raymond Hettinger]
> ...
>> Also, I'm not clear on the rationale for transforming negative
>> repetition counts to zero instead of raising an exception.
> 
> There are natural use cases.  Here's one:  you have a string and want
> to right-justify it to 80 columns with blanks if it's shorter than 80.
> 
>     s = " " * (80 - len(s)) + s
> 
> does the right thing in all cases, because the blank repetition
> gracefully collapses to an empty string whenever len(s) >= 80.  I've
> used that (and variants thereof) dozens of times.  Then again, I don't
> believe I've ever used the "integer * sequence" form (i.e., with the
> integer on the left).

I originally brought that up because decimal.py uses it.
(try to translate this to C code...)

Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4