I can use string.unpack if string in struct uses fixed amount of bytes.
But is there some extension to struct modue, which allows to unpack
zero-terminated string, size of which is unknown?
E.g. such struct: long, long, some bytes (string), zero, short, short,
short.
--
http://mail.python.org/ma
Hello all.
Anybody who has idle time, please look at my version of MIME tools at
http://www.fidoman.ru/prog/mime/.
Questions and critical notes are welcome. If somebody will consider that
interesting, I will refine these modules and put to pypi.
--
http://mail.python.org/mailman/listinfo/pyth
Hello all!
Please help, is there way to use sub-expressions in lambda?
For example, if I want to calculate sin(x^2)+cos(x^2) I must code:
lambda x: sin(x*x)+cos(x*x)
How to make x*x to be evaluated once?
--
http://mail.python.org/mailman/listinfo/python-list
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Please help, is there way to use sub-expressions in lambda?
For example, if I want to calculate sin(x^2)+cos(x^2) I must code:
lambda x: sin(x*x)+cos(x*x)
How to make x*x to be evaluated once?
>>>
>>
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sergey Dorofeev wrote:
>
>> Please help, is there way to use sub-expressions in lambda?
>> For example, if I want to calculate sin(x^2)+cos(x^2) I must code:
>> lambda x: si
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What syntax would you suggest for a lambda enhanced to cover your use
> case?
> I suppose you will end up with roughly the same number of characters, all
> crammed in one line -- or broken into lines at a random positio
Hello.
Why does not work?
--
import email.message
import smtplib
import time
m=email.message.Message()
m.set_type("multipart/mixed")
m["From"]="Sergey Dorofeev <[EMAIL PROTECTED]>"
m["To"]="Sergey Dorofeev <[EMAIL PROTECTE
"Rob Wolfe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>> p2=email.message.Message()
>> p2.set_type("message/rfc822")
>> p2.set_payload(m)
>
> Payload is a _list_ of Message objects (is_multipart() == True)
> or a _string_ object (is_multipart() == False) but never just Message
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> (1,)+[1]
Traceback (most recent call last):
File "", line 1, in
TypeError: can only concatenate tuple (not "list") to tuple
>>> [1]+(1,)
"James Stroud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>[1]+(1,)
>>
>> Traceback (most recent call last):
>> File "", line 1, in
>> TypeError: can only concatenate list (not "tuple") to list
>>
>>
>> Its ugly and boring.
>
> Agreed. This would be similar to:
>
> py> 1
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's effectively a tuple with field names. I don't know when the switch
> occurred (it's in 2.2, as far back as my built interpreter versions
> currently go), but back in the day os.stat used to return a plain old
> tuple.
posix.sta
11 matches
Mail list logo