pyt...@bdurham.com wrote:
  Is there a way to slice a string with a tuple without unpacking the tuple?

 >>> myString = "111-222-333-444"
 >>> myString[ 4: 7 ]
'222'

Is there some way I could perform an identical slicing operation with a tuple like ( 4, 7 ) without having to unpack the tuple?

 >>> myTuple = ( 4, 7 )

Thanks!

Does myString[myTuple[0] : myTuple[1]] count as unpacking? If it does, then how about myString.__getslice__(*myTuple)?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to