sequence multiplied by -1

MRAB python at mrabarnett.plus.com
Sat Oct 2 18:42:10 EDT 2010


On 02/10/2010 22:12, Dennis Lee Bieber wrote:
> On Sat, 02 Oct 2010 21:24:19 +0100, MRAB<python at mrabarnett.plus.com>
> declaimed the following in gmane.comp.python.general:
>
>> How about "~", which is currently has only a unary form:
>>
>>   >>>  "foo" ~ "bar"
>> 'foobar'
>>   >>>  [1, 2, 3] ~ [4, 5, 6]
>> [1, 2, 3, 4, 5, 6]
>>
>> Think of it as meaning "followed by".
>>
> 	I'd prefer to see it used for floating point comparison in the two
> character:
> 			x ~= y
> though one might need to set up some system parameter to define what the
> permissible delta would be...
>
> sys.floatDelta = 1.0E-6
>
> or something...

The form:

     x op= y

generally means:

     x = x op y

so we probably could've have both "~" and "~=".

Would there also be the opposite form, say, "!~", meaning:

     not x ~= y



More information about the Python-list mailing list