Feature Requests item #1212169, was opened at 2005-05-31 12:59 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1212169&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Aaron Elbaz (flamesrock) Assigned to: Nobody/Anonymous (nobody) Summary: Prepending Text Initial Comment: Perhaps this has already been considered, but I have an idea that would make neat addition to python: Appending a string to another string can be done with += or .join(), but currently, there is no elegant way to prepend to a string. How about something like- string.prepend(list.pop(0) ? ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2005-06-02 19:45 Message: Logged In: YES user_id=80475 All string concatenation in Python creates a new string and leaves the original untouched. So, there are no append operations. Likewise, the can be no prepend operations. Instead, there are only a+b operations whose result can be assigned to 'a' to give the effect of an append, to 'b' to give the effect of a prepend, and to 'c' to create a new variable leaving the inputs untouched. ---------------------------------------------------------------------- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-05-31 13:48 Message: Logged In: YES user_id=1188172 -0. What's wrong with >>> string = something + string Also, the above conveys the notion that this is an expensive operation (when done multiple times, e.g. in a loop) better than a str method. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1212169&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com