On Mon, Mar 21, 2011 at 9:05 AM, Marius Gedminas <mar...@gedmin.as> wrote:
> I'll just add a note that defining __getslice__ is not necessary to support
> slicing (in fact it's been deprecated since Python 2.0).  The modern way
> is to have your __getitem__ check if the argument passed to it is an
> instance of the builtin `slice` type.
>
> (You probably knew that already, but your wording above is a bit ambiguous.)

No, I didn't know that. I've never dealt with slices, just individual items.

Actually, I don't know if I can check for that. I can check for the
presence of a method, but not its semantics. Unless I call the method
and see what it does with a slice, but that would be silly and
potentially disruptive.

> Incidentally, what's that '__slice__' thing you're checking for in
> https://bitbucket.org/bbangert/webhelpers/changeset/556b55e75dd6#chg_webhelpers/paginate.py_newline215
> ?  docs.python.org has no knowledge of it.

Oh, that should be .__getslice__ . Maybe that's causing some of the
SQLAlchemy complications (but not all of them).

-- 
Mike Orr <sluggos...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to