[Python-3000] Mini Path object

Josiah Carlson jcarlson at uci.edu
Mon Nov 6 17:05:57 CET 2006


Talin <talin at acm.org> 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.


 - Josiah



More information about the Python-3000 mailing list