Jason Grout <jason-s...@creativetrax.com> writes: > On 11/5/12 7:40 PM, Michael Orlitzky wrote: >> I didn't realize foo[1,2] would pass the tuple (1,2) to __getitem__ >> until the very end, so it would make sense to go back and replace the >> function calls with indexing. >> >> I think the only thing we'd lose is a() -> 'a', and that isn't a big >> deal (it also isn't technically part of the sequence). > > What about a[None] returning a? That's a little awkward, I guess.
Well, foo[1] calls foo.__getitem__(1), and foo[1,2] calls foo.__getitem__((1,2)); if foo[] were a valid syntax, and we considered individual values to be equivalent to 1-tuples (which technically they are not, in Python), then foo[] should call foo.__getitem__(()) (i.e. pass the empty tuple). foo[] is not a valid syntax, and foo[None] will call foo.__getitem__(None), but foo[()] will call foo.__getitem__(()), so maybe foo[()] is what you're looking for? :) -Keshav -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to sage-devel@googlegroups.com. To unsubscribe from this group, send email to sage-devel+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en.