[Python-ideas] Removing some string methods?
Brett Cannon
brett at python.org
Sat May 17 07:16:55 CEST 2008
On Fri, May 16, 2008 at 12:36 PM, Raymond Hettinger <python at rcn.com> wrote:
> [AMK]
>>
>> Has any consideration been given to removing some of the lesser-used
>> string methods in 3.0? e.g. .center, .ljust/rjust, .zfill, .swapcase?
>
> I don't think we gain anything by taking justification and centering methods
> away. It just makes life difficult for people like me who use those
> methods for formatting text. Also, these methods have nearly zero mental
> overhead -- they are self-explanatory and have no learning curve.
>
> The swapcase() method is more use case challenged and could probably be
> zapped without anyone caring.
>
> The zfill() method is no longer necessary because rjust() takes an optional
> fillchar argument:
>
> '123'.zfill(10) == '123'.rjust(10, '0')
Ah cool! I don't think I knew about that because I always knew about
zfill(). Probably would have found it if I zfill() didn't exist.
So for Python 3.1 we can probably safely ditch the two methods (and
probably review the methods on the other types as well).
-Brett
More information about the Python-ideas
mailing list