[Python-ideas] get method for sets?

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 17 03:51:04 CEST 2012


On 17/05/12 04:28, Steven D'Aprano wrote:
> Which element should it return? "Any
> element, so long as it isn't always the same element twice in a row" perhaps?
> Would flip-flopping between the first and second elements meet your requirements?

It might be useful to have a method specified as returning the
same element that a subsequent pop() would return. Then it could
be used as a look-ahead for an algorithm involving a pop-loop,
or for anything with more liberal requirements.

-- 
Greg



More information about the Python-ideas mailing list