Re: [code-quality] __len__ but no __getitem__

2013-09-23 Thread Skip Montanaro
> Several times I've implemented classes with dynamic behaviour in > __getitem__, so they have no strict length (beyond "theoretically > infinite"). Understood, and that's a case where I think you should suppress the warning. I believe the common case is that if you can get a particular item you c

Re: [code-quality] __len__ but no __getitem__

2013-09-23 Thread Michael Foord
On 23 September 2013 22:14, Skip Montanaro wrote: > >> Should pylint really be this strict? Or am I expected to implement > >> everything necessary for an array-like containiner and just raise > >> exceptions in those methods the user really shouldn't access? > > > > No I'ld say you're right. Whi

Re: [code-quality] __len__ but no __getitem__

2013-09-23 Thread Skip Montanaro
>> Should pylint really be this strict? Or am I expected to implement >> everything necessary for an array-like containiner and just raise >> exceptions in those methods the user really shouldn't access? > > No I'ld say you're right. While it sounded a good idea when proposed, you're > not > the f

Re: [code-quality] __len__ but no __getitem__

2013-09-23 Thread Sylvain Thénault
Hi Skip, On 23 septembre 09:07, Skip Montanaro wrote: > Having demonstrated my confusion about early breaks from loops, I will > proceed to demonstrate my confusion about containers. :) > I have a queue-like class in which I implement __len__ but not > __getitem__. Pylint complains: > > timedd

[code-quality] __len__ but no __getitem__

2013-09-23 Thread Skip Montanaro
Having demonstrated my confusion about early breaks from loops, I will proceed to demonstrate my confusion about containers. I have a queue-like class in which I implement __len__ but not __getitem__. Pylint complains: timeddata.py:79: [R0924(incomplete-protocol), TimedDataQueue] Badly implemente