No explanation, but this is one aspect of "pythonic" that has been bothering me of late.
The general consensus is that you should use duck typing, and in general not have items of a different type in one place. So the "pythonic" solution would be to have getslice, I would think, but if that is not available, the "pythonic" thing to do is something like: try: foo.slicy_thing() except TypeError: foo.number_thing() IMO, exceptions are for exceptional occasions, not for disguised if statements. But, that's the way Python seems to work. Pepijn On Apr 19, 2012, at 4:10 PM, Dexter wrote: > Hi, > > So they're re-factoring python a bit, some backwards (incompatible) changes > to fix certain inconsistencies. > And I also knew that some other inconsistencies aren't gonna be changed, > because of backwards incompatibility. > But I didn't know that they were also introducing inconsistencies, which is > also breaking backwards compatibility. > > getslice is being depricated, if you wanna use that, you should use getitem > in p3k. So now, you should check if your argument is an index or a slice. > Can anyone explain why? > > Greetings, Dexter > _______________________________________________ > Python-nl mailing list > Python-nl@python.org > http://mail.python.org/mailman/listinfo/python-nl _______________________________________________ Python-nl mailing list Python-nl@python.org http://mail.python.org/mailman/listinfo/python-nl