Timeline for Looking for a pattern in a list
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 21, 2016 at 3:26 | vote | accept | Andy K | ||
Jul 20, 2016 at 10:50 | comment | added | ChatterOne | @AndyK if you don't need to compute something, just don't do it :-) If the purpose of the function was to return the patterns that you found, you may have had a point. But if all you need is a check that the pattern exists, just return True as soon as the first pattern is found, no need to save the elements. | |
Jul 20, 2016 at 9:35 | comment | added | Andy K |
Hi @chatterone, thanks for your feedback. ok for separating the functionS, this is what I did initially but I said to myself Hey why not put everything into one umbrella? Can you explain a bit more If you only need to check the existence of something, use a boolean value and return as soon as you've found it. Adding elements to a list so that at the end you can count them and return a boolean based on the count is definitely not an efficient way to do it. this part?
|
|
Jul 20, 2016 at 9:29 | history | answered | ChatterOne | CC BY-SA 3.0 |