Hi, FTR, I was not implying the $PIECE() was an answer at all, but only suggesting it as an alternative name to .partition(). .piece() can be both a verb and a noun as can .partition(), thus overcoming Nick's objection to a "noun"ish thing doing the work of a "verb"ish thing.
Also, IIRC, I did say it would need to be "Pythonified". I pointed to the official definition of $PIECE() merely to show that it was more than a .split() as it has (sort of) some of the notion of a slice. Phillip, I think, as I presented the $PIECE() thing, you were totally justified to recoil in horror. That said, it would be nice if there were a way to "save" the result of the .partition() result in a way that would not require duplicating the .partition() call (as has been suggested) making things like: ... s.partition(":").head, s.partition(":").tail unnecessary. One could get accustomed to the _,_,tail = s.partition(...) style I suppose, but it seems a bit "different", IMO. Also, it seems that the interference with i18n diminishes the appeal of that style. Cheers, --ldl On 8/30/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > ... > No, just to point out that you can make up whatever semantics you want, but > the semantics you show above are *not* the same as what are shown at the > page the person who posted about $PIECE cited, and on whose content I based > my reply: > > http://www.jacquardsystems.com/Examples/function/piece.htm > > If you were following those semantics, then the code you presented above is > buggy, as host.piece(':',1,2) would return the original string! > > Of course, since I know nothing of MUMPS besides what's on that page, it's > entirely possible I've misinterpreted that page in some hideously subtle > way -- as I pointed out in my original post regarding $PIECE. I like to > remind myself and others of the possibility that I *could* be wrong, even > when I'm *certain* I'm right, because it helps keep me from appearing any > more arrogant than I already do, and it also helps to keep me from looking > too stupid in those cases where I turn out to be wrong. Perhaps you might > find that approach useful as well. > > In any case, to avoid confusion, you should probably specify the semantics > of your piece() proposal in Python terms, so that those of us who don't > know MUMPS have some possibility of grasping the inner mysteries of your > proposal. > -- LD Landis - N0YRQ - from the St Paul side of Minneapolis _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com