!in

Michel Fortin michel.fortin at michelf.com
Wed Feb 17 09:40:50 PST 2010


On 2010-02-17 11:24:43 -0500, bearophile <bearophileHUGS at lycos.com> said:

> In Python there are no chars, there are just strings, a char is a 
> string of length 1, so the __contains__ performs a substring search 
> (with many optimizations, so if you look for a substring of length 1 
> it's faster, etc).

Actually that's an interesting topic. You're suggesting that 'in' for 
arrays could search not only for elements but also for subarrays?

The interesting part is that the syntax is very natural. The less 
interesting part is that it's slower and slightly different from 'in' 
in associative arrays. I'm on the fence.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list