declaration problem
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Nov 7 07:11:17 EST 2008
On Fri, 07 Nov 2008 16:05:22 +0530, devi thapa wrote:
> I am using the command
>
> recv(..) to receive a message from client.
>
> retval = recv(my_socket, *buf, len(buf) , 0)
>
> and its giving this error
>
> File "./server1.py", line 31
> retval = recv(my_socket, *buf, len(buf) , 0)
> ^
> SyntaxError: invalid syntax
``*buf`` means "unpack everything in `buf` as if it where written as
positional arguments". It is not some "pointer dereferencing" syntax, as
Python doesn't have pointers as data types. After argument unpacking it
is not allowed to have other positional arguments. That's the syntax
error.
>From where do you get `recv()` anyway? And what is `my_socket`? Most
certainly not an instance created with `socket.socket` because then you
would use the `recv()` method of that object.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list