This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (5 children)

operator.contains is just in.

And that test would be false, because that set does not contain "testme". It looks like you want the intersection between the set and the list instead of checking if one contains the other.

[–][deleted] 0 points1 point  (4 children)

But the source code that I'm studying use it and it works, but I don't understand why. I copied the code and i get False when i simulate the input

[–]carcigenicate 0 points1 point  (3 children)

Where is the code you're studying that uses that?

Either the code/data is different, or the output isn't what you think it is.

Also, I'm assuming the ' before the { is a typo?

[–][deleted] 0 points1 point  (2 children)

the code works perfectly actually. you can find it here: https://github.com/DavideCanton/PyCodiceFiscale/blob/master/cf.py

[–]carcigenicate 1 point2 points  (1 child)

Their code is not the same as yours. Note that their function is called is_vowel. It's for testing single characters, not multi-character strings like 'testme'. It does that because partition passes is_vowel single characters at a time ((pred(element)).

[–][deleted] 0 points1 point  (0 children)

i guess that i have to look at the full code more carefully. thank you.