On May 2, 6:41 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] a écrit :
>
> > On May 2, 3:49 pm, Basilisk96 <[EMAIL PROTECTED]> wrote:
>
> >>A simple
>
> >>if s:
> >>    print "not empty"
> >>else:
> >>    print "empty"
>
> >>will do.
>
> > How do you know that s is a string?
>
> Why do you want to know if it's a string ?

>>> import gmpy
>>> gmpy.mpz(11)
mpz(11)
>>> gmpy.mpz('11',10)
mpz(11)
>>> gmpy.mpz(11,10)

Traceback (most recent call last):
  File "<pyshell#38>", line 1, in <module>
    gmpy.mpz(11,10)
TypeError: gmpy.mpz() with numeric argument needs exactly 1 argument

The mpz conversion takes two arguments if and only if s is a string,
else it takes 1 argument. So being non-empty is insufficient.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to