nntplib and xover

Gerhard Häring gerhard.nospam at bigfoot.de
Sat Sep 22 11:12:01 EDT 2001


On 21 Sep 2001 16:59:33 +0200, Martin von Loewis wrote:
>Gerhard =?ISO-8859-1?Q?H=E4ring?= <g.haering at ___skynamics.com.invalid> writes:
>
>> > this just adds an xref element to the tuple, right? i bet many
>> > people unpack the returned tuple into variables straight away,
>> > so the change would cause some code breakage.
>> 
>> 
>> Ups. Didn't think of that. Then I guess there's no way to modify the 
>> xover function that is also backwards compatible. I also didn't check 
>> any RFCs, this was just a quick shot.
>
>It certainly is possible. You could return an instance of
>[talking about subclassing tuple]

I haven't thought of that. IMO using fixed-sized tuples as function parameters
or return values isn't good practise anyway. They aren't extensible in a clean
way and to know what one index means, you always have to read the docs.

Consider:
    sender = n.xover("16000","16000")[1][0][2]
vs. (hypothetical)
    sender = n.xover(16000, 16000).results[0].poster

The second one would look much cleaner to me.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list