On Fri, Dec 26, 2008 at 6:47 AM, Alan Gauld <alan.ga...@btinternet.com>wrote:
> > "Kent Johnson" <ken...@tds.net> wrote > >> for d in os.listdir(): >>> if MyString(d).upper().beginswith(....): >>> >> >> But that won't work, the result of calling upper() will be a normal >> str, not a MyString. >> > > Ah yes. Immutability of strings strikes again. upper() returns a new > string, I forgot about that. pity. > > You can do > > if MyString(d.upper()).beginswith(...) > > But that loses a lot in elegance and is hardly better than using a > fiunction. > > Alan G > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > Thank you Alan and everybody. I simply prefer the built-in one. I had no idea it could take a tuple. What is amazing is that I learn more from this list than I do from any other source. -- لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد الغزالي "No victim has ever been more repressed and alienated than the truth" Emad Soliman Nawfal Indiana University, Bloomington http://emnawfal.googlepages.com --------------------------------------------------------
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor