[python-users] assert expression1, expression2 != assert (expression1, expression2)

Rex Turnbull RexTurnbull at web.de
Di Jul 1 21:31:35 CEST 2008


Danke für den Hinweis Günter. Hatte ich auch selber schon früher 
gewusst, aber irgendwie wieder vergessen. assert als 'unäre operator' 
ist irgendwie ecklig.
Rex

Jantzen schrieb/wrote:
> Rex schrieb:
>   
>>>>> assert 1
>>>>> assert 0
>>>>>           
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <string>
>> AssertionError:
>>     
>>>>> assert 0, 'hi'
>>>>>           
>> Traceback (most recent call last):
>>   File "<string>", line 1, in <string>
>> AssertionError: hi
>>     
>>>>> assert (0, 'hi')
>>>>>
>>>>>           
>
> Hallo Rex,
>
>   
>>>> assert (0, 'hi')
>>>>         
>
> Der assert sieht ein Tupel mit zwei Elementen und das ist True (warum wissen die Götter)
> Hingegen:
>
>   
>>>> assert () , "ich armes nichts"
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AssertionError: ich armes nichts
>   
>
> Gruss
> Günter
>
> ________________________________________
> Diese Mail erhalten Sie ueber die Mailingliste Python-users der Universitaet zu Koeln
> Python-users at uni-koeln.de
> https://lists.uni-koeln.de/mailman/listinfo/python-users
>   




Mehr Informationen über die Mailingliste python-users