Well, the docs you link say slicing should be done via __getitem__
now.  Which is also present in dicts of course.

Why not approach the problem from the other direction?

try:
  maybedict.keys()
except AttributeError:
  ismapping = True
else:
  ismapping = False

?

On 7/25/07, Catherine <[EMAIL PROTECTED]> wrote:
>
> Whoops!  Never mind; deprecation is a really good reason.
>
> http://docs.python.org/ref/sequence-methods.html
> __getslice__(   self, i, j)
>     Deprecated since release 2.0.
>
> The trouble is (and, sorry, this is getting beyond SQLAlchemy-
> specific), that leaves me without any good ideas for how to
> distinguish sequence types (lists, tuples, and user-defined objects
> resembling them) from mappings (dicts).
>
> Also, I don't need to at present, but it still leaves it impossible to
> take a slice from a RowProxy.  It seems possibly useful.
>
> resultrow[1:2]
> TypeError: unhashable type
>
> So, for the moment, I'm looking into whether I could write a patch for
> that, then try-and-catch to do my duck typing.  If you know a reason
> RowProxy's -shouldn't- support slicing, say so!
>
> - Catherine
> http://catherinedevlin.blogspot.com
>
>
> >
>

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

Reply via email to