Josiah Carlson wrote: > Talin <[EMAIL PROTECTED]> wrote: >> I'd like to replace this with: >> >> .component( slice_object ) >> >> where the semantics of 'component' are identical to __getitem__ on an >> array or tuple. So for example: >> >> Path( "a", "b" ).component( 0 ) => "a" >> Path( "a", "b" ).component( 1 ) => "b" >> Path( "a", "b" ).component( -1 ) => "b" >> Path( "a", "b" ).component( 0:1 ) => Path( "a", "b" ) >> Path( "a", "b" ).component( 1: ) => Path( "b" ) > > Use a property or list or something. Something with __getitem__. In > 2.5 it is a syntax error to use slices like that, and it would seem > silly to change 3.x syntax to be able to pass slices directly like that.
That's unfortunate. I specifically want to avoid saying something like path[ 1:2 ], because its ambiguous and confusing, especially if "Path" is derived from unicode. I suppose path.components[ 1:2 ] would be all right. > - Josiah _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com