python-caldav / caldav

Apache License 2.0
312 stars 91 forks source link

refactoring maps code on set comprehension #417

Closed ArtemIsmagilov closed 3 weeks ago

ArtemIsmagilov commented 3 weeks ago
  1. bytecode faster
  2. the code is easier
  3. speed finding elements in set O (1) (hashable elemets)
tobixen commented 3 weeks ago

Seems good to use set rather than list, but I will have to review this one a bit more carefully.

ArtemIsmagilov commented 3 weeks ago

look example

print(' sa asd asd\r\n \f \t dad as as , asd'.split())
['sa', 'asd', 'asd', 'dad', 'as', 'as', ',', 'asd']
ArtemIsmagilov commented 3 weeks ago

This method is used only in 2 places to search for a string, set is suitable here. Map, filter and lambda are unnecessary here. For library users, nothing should change.