viralogic / py-enumerable

A Python module used for interacting with collections of objects using LINQ syntax
MIT License
188 stars 24 forks source link

.first() unexcpected result #35

Closed inielse closed 4 years ago

inielse commented 4 years ago

pip installed version 1.1.0 on Anaconda I was doing a chain of x.where(..).order_by(..).first(), but kept getting an unexpected result I can reproduce the behavior like this:

from py_linq import Enumerable
a = Enumerable([9,8,-7,6,5])
b = a.order_by(lambda x: x)
print(b.first())  #returns 9, was expecting -7
print(list(b)[0]) #returns -7
print(b.first())  #now it returns -7
viralogic commented 4 years ago

This fix will be a part of version 1.2