Python 3000 idea -- + on iterables -> itertools.chain

2006-11-12 Thread John Reese
It seems like it would be clear and mostly backwards compatible if the + operator on any iterables created a new iterable that iterated throught first its left operand and then its right, in the style of itertools.chain. This would allow summation of generator expressions, among other things, to h

UNIX timestamp from a datetime class

2005-12-06 Thread John Reese
Hi. >>> import time, calendar, datetime >>> n= 1133893540.874922 >>> datetime.datetime.fromtimestamp(n) datetime.datetime(2005, 12, 6, 10, 25, 40, 874922) >>> lt= _ >>> datetime.datetime.utcfromtimestamp(n) datetime.datetime(2005, 12, 6, 18, 25, 40, 874922) >>> gmt= _ So it's easy to create datet

Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol

2005-07-17 Thread John Reese
On Sun, 17 Jul 2005 11:05:06 +0100, Stephen Illingworth <[EMAIL PROTECTED]> wrote: > John Reese wrote: >> Morning. I've been running into an error message pertaining to SSL >> that I don't understand, and I was hoping someone had some insight. >> Gmail pro

SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol

2005-07-16 Thread John Reese
Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: %python Python 2.4.1 (#1, May 16 2005, 15:19:29) [G

Re: Why is there no instancemethod builtin?

2005-06-17 Thread John Reese
On Fri, 17 Jun 2005 16:40:56 -0600, <[EMAIL PROTECTED]> wrote: > John Reese wrote: >> I now do: >> >> if isinstance(x, list): >> >> It is my understanding that this is what people do nowadays. > > I wouldn't go that far. I don't have

Why is there no instancemethod builtin?

2005-06-17 Thread John Reese
Why hello there ha ha. I have got in the habit of testing the types of variables with isinstance and the builtin type names instead of using the types module, as was the style back around Python 2.1. That is, rather than if type(x) == types.ListType: I now do: if isinstance(x, list): It

unbuffering std streams in code

2005-05-27 Thread John Reese
You know how you can specify that stderr, stdin, stdout should be unbuffered by running python with the -u switch? Is there any way I can have the same affect in code by doing something to the sys.std* variables? -- http://mail.python.org/mailman/listinfo/python-list

reference counting and file objects

2005-05-17 Thread John Reese
def uselessHash(filename): fp= open(filename) hash= 0 for line in fp: hash ^= hash(line.strip()) fp.close() # do I need this or is fp closed by ref count? return hash Consider the function above. Do I need the fp.close(), or will the file be closed automatically when fp goes out

Re: memory profiler?

2005-04-23 Thread John Reese
On Wed, 20 Apr 2005 23:06:51 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: > John Reese wrote: >> Is there a memory or heap profiler for python programs? So that, for >> example, if a program was bloating over time I could see how many of >> each object there we

memory profiler?

2005-04-20 Thread John Reese
Good afternoon, ha ha ha! Is there a memory or heap profiler for python programs? So that, for example, if a program was bloating over time I could see how many of each object there were and maybe even where the references were? -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a library to parse Mozilla "mork" documents?

2005-01-21 Thread John Reese
On Thu, 20 Jan 2005 23:48:34 -0800, Tim Roberts <[EMAIL PROTECTED]> wrote: > John Reese <[EMAIL PROTECTED]> wrote: >> >>Mozilla, Firefox, Thunderbird, and so forth use this awful format >>called MORK to store all kinds of things: which messages you've read

Is there a library to parse Mozilla "mork" documents?

2005-01-20 Thread John Reese
Mozilla, Firefox, Thunderbird, and so forth use this awful format called MORK to store all kinds of things: which messages you've read in a newsgroup, headers and indexes into the mbox file of messages in a mail folder, and address books. It's documented to some extent here: http://www.mozilla.org

Re: HTTP GET request with basic authorization?

2005-01-03 Thread John Reese
On 03 Jan 2005 18:27:52 +, John J. Lee <[EMAIL PROTECTED]> wrote: > Jonas Galvez <[EMAIL PROTECTED]> writes: > >> Christopher J. wrote: >> > I tried this, but it didn't work: >> > conn.request("GET", "/somepage.html", None, >> > {"AUTHORIZATION": "Basic username:password"}) > [...] >> import r

Re: using HTTP Digest auth with arbitrary HTTP methods?

2005-01-03 Thread John Reese
On 03 Jan 2005 18:11:06 +, John J. Lee <[EMAIL PROTECTED]> wrote: > (Re ternary operator: Everybody who read this list at certain times in > the past is painfully aware of that fact, and of precisely why it's > not quite true, and of all the syntax alternatives for real ternary > conditionals t

Re: using HTTP Digest auth with arbitrary HTTP methods?

2005-01-02 Thread John Reese
In comp.lang.python, [I] wrote: > Hello there. I've run into some missing functionality with HTTP Digest > authentication in the 2.3 library and I was wondering if I'm just > missing something. > > Missing functionality the first: urllib2 > > 1a. You can add "handlers" to your opener indicating

using HTTP Digest auth with arbitrary HTTP methods?

2005-01-02 Thread John Reese
Hello there. I've run into some missing functionality with HTTP Digest authentication in the 2.3 library and I was wondering if I'm just missing something. Missing functionality the first: urllib2 1a. You can add "handlers" to your opener indicating that you want to use HTTP Digest auth.