Re: Python licence again

2005-04-27 Thread Christos Georgiou
On Tue, 26 Apr 2005 23:26:41 +1000, you wrote:

[snip]

>>>Yup, pesky furriners, can't spell 'Merican prop'ly like God intended;
>>>they shouldn't be allowed on the net, sheriff should run 'em right out
>>>o' the county ...
>>
>>Sheriff is not available, for further info pls ask for R. Marley.

>I don't understand the connection with Bob Marley; pls enlighten me.

He shot the sheriff.

>>>> and heading
>>>
>>>Would that be like heading a soccer ball?
>>
>>Or heeding the sucker call (like I just did?)

>What makes you think you were heeding a sucker call?

Perhaps it's just bad wordplay from me.  I assumed you knew that
'heading' was a misspelt 'heeding' but you playingly used literally
"heading" in your reply.  For those who didn't get understand that,
though, I offered the correct "heeding" and then rhyming with "soccer
ball", I presented myself as the sucker who offered the correct spelling
when _it was not needed_.

So I didn't think I was heeding a sucker call at any moment, I just
wrote that as a pun.  There were no indirect accusations about your
post, if that is what you meant.

>>>>the google
>>>>suggestions that probably looked like "didn't you mean : Python License"
>>
>>>You might find, were you to try it, that it makes no such suggestions.
>>
>>Google isn't what it used to be when I was 6 yrs old.
>
>That would make you, what, say 10 years old now?

When I was 6 yrs old, Google was inexistant.  It isn't anymore, so my
assertion is correct (even though it's useless :)  I'm 33 btw.
-- 
Christos Georgiou, Customer Support Engineer
Silicon Solutions, Medicon Ltd.
Melitonos 5, Gerakas 153 44 Greece
Tel +30 21 06606195 Fax +30 21 06612666 Mob +30 693 6606195
"Dave always exaggerated." --HAL
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3! Finally!

2005-10-04 Thread Christos Georgiou
On Fri, 30 Sep 2005 20:50:06 +0200, rumours say that Stefan Behnel
<[EMAIL PROTECTED]> might have written:

>Weird, though, the md5sum is the same as for the Python-2.4.2.tar.bz2 that I
>downloaded late (late!) yesterday evening and had forgotten in my download
>directory... just found it next to the new one... was still there, not
>overwritten...
>
>Well, maybe the changes needed to merit a V3 weren't that big after all...

No, it's just proof that the MD5 checksum isn't reliable and we should
move forward to SHA checksums.  Amazing coincidence.  Let's xpost to
some security newsgroup.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spoiler to Python Challenge (help!!!)

2005-10-04 Thread Christos Georgiou
On Tue, 27 Sep 2005 10:42:20 -0500, rumours say that Terry Hancock
<[EMAIL PROTECTED]> might have written:

>This works:
>
 bz2.decompress(eval(repr(user)))
>'huge'

>This may have some security issues, though, since it evaluates essentially
>any expression given for user.  I'd be interested to know if someone
>knows a more secure way.

given

a = "a tab\\x09between"

this is more secure than eval:

b= a.decode("string_escape")
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Does any one recognize this binary data storage format

2005-10-05 Thread Christos Georgiou
On Wed, 10 Aug 2005 13:23:22 GMT, rumours say that [EMAIL PROTECTED] (Bengt
Richter) might have written:

>BTW, my second post was doing ''.join(chr(int(h[i:i+2],16)) for i in 
>xrange(0,16,2))
>to undo the hexlify you had done (I'd forgotten that there's a 
>binascii.unhexlify ;-)

And there's also str.decode('hex'), at least after 2.3 .
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Perl's documentation come of age

2005-10-10 Thread Christos Georgiou
On Wed, 05 Oct 2005 21:36:47 -0600, rumours say that Mahesh Padmanabhan
<[EMAIL PROTECTED]> might have written:

>In article <[EMAIL PROTECTED]>,
> "Xah Lee" <[EMAIL PROTECTED]> wrote:
>
>

>While I don't like to feed the trolls, I do find his posts amusing. He 
>is like a spoilt child seeking attention.

s/is like/is/
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to show Chinese Characters in the value set of a dictionary

2006-01-13 Thread Christos Georgiou
On 1 Jan 2006 07:35:31 -0800, rumours say that "zxo102" <[EMAIL PROTECTED]>
might have written:

 dict.values()
>['\xd6\xd0\xb9\xfa\xb6\xfe', '\xd6\xd0\xb9\xfa\xd2\xbb']
>
>Since the result of dict.values will be inserted into web pages and
>handled by javascript there, I want to show Chinese Characters
>in the list directly like this,
>
>['???','???']

Diez's instructions were useful to you, however for quick previewing check
this recipe, it might be useful:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/439148
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Widget that displays a directory tree?

2006-01-16 Thread Christos Georgiou
On Thu, 12 Jan 2006 11:55:46 -0500, rumours say that "Edward C. Jones"
<[EMAIL PROTECTED]> might have written:

>Do any of the Python GUIs have a super-high-level widget that displays a 
>directory tree? Most file managers or editors have this type of window.

If you have idle installed, you can check the PathBrowser.py file in your
idlelib directory.  (Run idle; click File -> Path Browser to see it in
action, and click File -> Open Module -> PathBrowser -> OK to see/edit the
source).
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin"
<[EMAIL PROTECTED]> might have written:

>Say I have some string that begins with an arbitrary sequence of characters 
>and then alternates repeating the letters 'a' and 'b' any number of times, 
>e.g.
>
>"xyz123aaabbaaabaaaabb"
>
>I'm looking for a regular expression that matches the first, and only the 
>first, sequence of the letter 'a', and only if the length of the sequence is 
>exactly 3.
>
>Does such a regular expression exist?  If so, any ideas as to what it could 
>be?

Is this what you mean?

^[^a]*(a{3})(?:[^a].*)?$

This fits your description.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 16:26:57 GMT, rumours say that "Roger L. Cauvin"
<[EMAIL PROTECTED]> might have written:

>"Christos Georgiou" <[EMAIL PROTECTED]> wrote in message 
>news:[EMAIL PROTECTED]

>> On Thu, 26 Jan 2006 14:09:54 GMT, rumours say that "Roger L. Cauvin"
>> <[EMAIL PROTECTED]> might have written:

>>>Say I have some string that begins with an arbitrary sequence of 
>>>characters
>>>and then alternates repeating the letters 'a' and 'b' any number of times,
>>>e.g.
>>>
>>>"xyz123aaabbaaabaaaabb"
>>>
>>>I'm looking for a regular expression that matches the first, and only the
>>>first, sequence of the letter 'a', and only if the length of the sequence 
>>>is
>>>exactly 3.
>>>
>>>Does such a regular expression exist?  If so, any ideas as to what it 
>>>could
>>>be?
>>
>> Is this what you mean?
>>
>> ^[^a]*(a{3})(?:[^a].*)?$
>
>Close, but the pattern should allow "arbitrary sequence of characters" that 
>precede the alternating a's and b's to contain the letter 'a'.  In other 
>words, the pattern should accept:
>
>"xayz123aaabbab"
>
>since the 'a' between the 'x' and 'y' is not directly followed by a 'b'.
>
>Your proposed pattern  rejects this string.

1.

(a{3})(?:b[ab]*)?$

This finds the first (leftmost) "aaa" either at the end of the string or
followed by 'b' and then arbitrary sequences of 'a' and 'b'.

This will also match "" (from second position on).

2.

If you insist in only three 'a's and you can add the constraint that:

* let s be the "arbitrary sequence of characters" at the start of your
searched text
* len(s) >= 1 and not s.endswith('a')

then you'll have this reg.ex.

(?<=[^a])(a{3})(?:b[ab]*)?$

3.

If you want to allow for a possible empty "arbitrary sequence of characters"
at the start and you don't mind search speed

^(?:.?*[^a])?(a{3})(?:b[ab]*)?$

This should cover you:

>>> s="xayzbaaa123aaabbab"
>>> r=re.compile(r"^(?:.*?[^a])?(a{3})(?:b[ab]*)?$")
>>> m= r.match(s)
>>> m.group(1)
'aaa'
>>> m.start(1)
11
>>> s[11:]
'aaabbab'
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 16:41:08 GMT, rumours say that "Roger L. Cauvin"
<[EMAIL PROTECTED]> might have written:

>Good suggestion.  Here are some "test cases":
>
>"xyz123aaabbab" accept
>"xyz123aabbaab" reject
>"xayz123aaabab" accept
>"xaaayz123abab" reject
>"xaaayz123aaabab" accept

Applying my last regex to your test cases:

>>> r.match("xyz123aaabbab")
<_sre.SRE_Match object at 0x00B47F60>
>>> r.match("xyz123aabbaab")
>>> r.match("xayz123aaabab")
<_sre.SRE_Match object at 0x00B50020>
>>> r.match("xaaayz123abab")
>>> r.match("xaaayz123aaabab")
<_sre.SRE_Match object at 0x00B47F60>
>>> print r.pattern
^(?:.*?[^a])?(a{3})(?:b[ab]*)?$

You should also remember to check the (match_object).start(1) to verify that
it matches the "aaa" you want.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning a tuple-struct

2006-01-26 Thread Christos Georgiou
On Thu, 19 Jan 2006 10:47:35 GMT, rumours say that "Giovanni Bajo"
<[EMAIL PROTECTED]> might have written:

>I have a generic solution for this (never submitted to the cookbook... should
>I?)

This is by Andrew Durdin:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303439

This is by me:

http://py.vaults.ca/apyllo.py/514463245.769244789.385587050
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 18:01:07 +0100, rumours say that "Fredrik Lundh"
<[EMAIL PROTECTED]> might have written:

>Roger L. Cauvin wrote:
>
>> Good suggestion.  Here are some "test cases":
>>
>> "xyz123aaabbab" accept
>> "xyz123aabbaab" reject
>> "xayz123aaabab" accept
>> "xaaayz123abab" reject
>> "xaaayz123aaabab" accept
>
>$ more test.py

[snip of code]
>m = re.search("aaab", string)
[snip of more code]

>$ python test.py
>gotexpected
>---
>accept accept
>reject reject
>accept accept
>reject reject
>accept accept

You're right, Fredrik, but we (graciously as a group :) take also notice of
the other requirements that the OP has provided elsewhere and that are not
covered by the simple test that he specified.

The code above works for "b" too, which the OP has already ruled out,
and it doesn't work for "aaa".
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Christos Georgiou
On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that "Roger L. Cauvin"
<[EMAIL PROTECTED]> might have written:

>Thanks, but the second test case I listed contained a typo.  It should have 
>contained a sequence of three of the letter 'a'.  The test cases should be:
>
>"xyz123aaabbab" accept
>"xyz123aabbaaab" reject

Here I object to either you or your need for a regular expression.  You see,
before the "aaa" in your second test case, you have an "arbitrary sequence
of characters", so your requirements are met.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using bytecode, not code objects

2006-02-10 Thread Christos Georgiou
On Sun, 29 Jan 2006 14:51:18 -0800, rumours say that Michael Spencer
<[EMAIL PROTECTED]> might have written:

>> http://www.effbot.org/librarybook/marshal.htm
 
>There's a typo in the text accompanying that example: img.get_magic() should 
>be 
>imp.get_magic().

The error is easy to explain: he's on PIL(s) for years.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Detecting filename-encoding (on WinXP)?

2006-02-10 Thread Christos Georgiou
On 2 Feb 2006 08:03:14 -0800, rumours say that "Tim N. van der Leeuw"
<[EMAIL PROTECTED]> might have written:

>So now what I need to know is, how do I find out in what encoding a
>particular filename is? Is there a portable way for doing this?

You said the filename comes as data, and not as contents of os.listdir(),
right?

You can only know (for almost certain) what encoding is *not* the filename
(by looping over encodings and marking those where .decode fails).  

If it was textual data, you could be more successful in guessing (btw, it's
been a long time since I requested example texts from various encodings for
my encoding-guessing app, but I was sent only one) by testing characters in
pairs and their frequencies.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hi reliability files, writing,reading and maintaining

2006-02-10 Thread Christos Georgiou
On Wed, 08 Feb 2006 00:29:16 +0100, rumours say that Xavier Morel
<[EMAIL PROTECTED]> might have written:

>You can also nest Raid arrays, the most common nesting are Raid 01 
>(creating Raid1 arrays of Raid0 arrays), Raid 10 (creating Raid0 arrays 
>of Raid1 arrays), Raid 50 (Raid0 array of Raid5 arrays), and the "Raids 
>for Paranoids", Raid 15 and Raid 51 arrays (creatung a Raid5 array of 
>Raid1 arrays, or a Raid1 array of Raid5 arrays, both basically means 
>that you're wasting most of your storage space for redundancy 
>informations, but that the probability of losing any data is extremely low).

Nah, too much talk.  Better provide images:

http://www.epidauros.be/raid.jpg

-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: random playing soundfiles according to rating.

2006-02-10 Thread Christos Georgiou
On Fri, 10 Feb 2006 09:59:43 +, rumours say that Ed Singleton
<[EMAIL PROTECTED]> might have written:

>If speed is no issue (for example you can queue an mp3 while the
>current one is playing), then Ben's solution is the classic one. 
>Store the total of all your scores (or calculate it on the fly if you
>don't have too many files), pick a random number up to that total, and
>then iterate through all your scores, subtracting each score from the
>total, until the total reaches zero, and then play that file.
>
>However that approach gets slower and slower the more files you have
>(slower to calculate the total and slower to iterate through the
>files).

Hm... just playing:

import random, itertools

scored=[('bad',1), ('not that bad',2),('ok',3),('better',4),('best',5)]

def player(lst):
def forever(lst):
while 1:
for item in lst:
yield item
total_score= sum(x[1] for x in lst)
scanner= forever(lst)
while 1:
next_score= random.randrange(total_score)
for item in scanner:
if next_score <= item[1]:
yield item[0]
next_score+= random.randrange(total_score)
else:
next_score-= item[1]


print list(itertools.islice(player(scored), 0, 20))

['better', 'ok', 'best', 'not that bad', 'best', 'best', 'best', 'not that
bad', 'ok', 'best', 'best', 'bad', 'better', 'better', 'better', 'ok', 'ok',
'not that bad', 'best', 'best']
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python-ldap

2006-02-13 Thread Christos Georgiou
On 7 Feb 2006 10:02:23 -0800, rumours say that "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> might have written:

>_)_

On 7 Feb 2006 10:02:25 -0800, rumours say that "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> might have written:

>_)_

You can't beat Steve with a pair of arses, because Steve's hand is
physically higher than your arse (even considering a big age-gap between you
two).

If you said o0o, I'd call your bluff a zero and raise an eye (make that a
capital eye).  I also believe that I could fit a db in there (as thin as the
crack may be), but (o)(o) would be cozier as a receptacle.

Now, let us all smart_)_s peace off.

PS should anyone grab the chance and mix ethnic jokes based on my
nationality in a reply, I'll have to tell you that I have been offended by
professionals during my army service and you'll barely scratch my back :)
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Another try at Python's selfishness

2006-02-13 Thread Christos Georgiou
On Thu, 9 Feb 2006 10:35:37 +0100, rumours say that "Frithiof Andreas
Jensen" <[EMAIL PROTECTED]> might have written:

>If one was trying to detect fanatics of any creed, a certain indicator would
>be that they have absolutely no sense of humour - they suffer from a
>yet-to-be-described variant of autism I.M.O.

Although I generally agree, I've seen images of fanatics laughing madly when
they employ their fanatism; so they might have some sense of humour, even if
a perverted one (perverted relative to your or my sense of humour, obviously
:)  They tend to lack self-sarcasm, though.

Anyway, someone wiser than me (probably so much wiser that I subconsciously
forgot their name!) said: "The difference between a saint and a fanatic is
that the saint fights the evil inside him/herself..."
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tracking down memory leaks?

2006-02-13 Thread Christos Georgiou
On 12 Feb 2006 05:11:02 -0800, rumours say that "MKoool"
<[EMAIL PROTECTED]> might have written:

>I have an application with one function called "compute", which given a
>filename, goes through that file and performs various statistical
>analyses.  It uses arrays extensively and loops alot.  it prints the
>results of it's statistical significance tests to standard out.  Since
>the compute function returns and I think no variables of global scope
>are being used, I would think that when it does, all memory returns
>back to the operating system.

Would your program work if you substituted collections.deque for the arrays
(did you mean array.arrays or lists?)?  Please test.

>Instead, what I see is that every iteration uses several megs more.
>For example, python uses 52 megs when starting out, it goes through
>several iterations and I'm suddenly using more than 500 megs of ram.

If your algorithms can work with the collections.deque container, can you
please check that the memory use pattern changes?

>Does anyone have any pointers on how to figure out what I'm doing
>wrong?

I suspect that you have more than one large arrays (lists?) that
continuously grow.

It would be useful if you ran your program on a fairly idle machine and had
a way to see if the consumed memory seems to be swapped out without being
swapped in eventually.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python-ldap

2006-02-14 Thread Christos Georgiou
On 13 Feb 2006 11:11:05 -0800, rumours say that "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> might have written:

>hy...

>if you dont know how to help people here... dont say "google it".

I never said "google it".  I presume you mean this post as a reply to all
other posters in this thread, right?  And you can bet your tiny _)_ that
Steve Holden does know how to help people here, something that can be proven
if you google for previous posts of him.

>groups.google was made to help! not to say google it!

groups.google was made to *archive* newsgroups. By using groups.google, you
just participate in the larger community of Usenet.  Google that strange
term "usenet".  It's kind of public email.  You send to a "newsgroup", then
everybody in the world can see your message, and anybody can reply, and so
forth.

You'll see in one of the top hits (for "usenet") that Google sometime
acquired the Usenet Archive of Deja (Deja.com, DejaNews.com etc), which are
archives of newsgroups since before Google existed.  There is no company
"google.groups" full of professionals getting paid to answer your questions.

Think of groups.google as an agency that allows you to travel in the
dangerous world of Usenet.

>i really dont not what kind of professional you are to say "google it!"

Assuming you reply to Steve Holden; you have false logic.  Like I said,
nobody ever gets paid for replying to newsgroup posts, so professionalism
does not get involved in any sense.  Or have you sent any money to the PSF
[Python Software Foundation] asking for support?  If that is the case, I
fully apologize, and please don't read the rest of my post! ;)

>you are smart boy!

I used to be before I grew up.

>i think your mom has much pride of you!

Especially since she will shortly be a grand mother.

>google it to learn more than say "google it!"

Your writing style hints you are 14-15 yrs old, but you can also be some
non-native English speaker (as I am), even an IT professional (the topic of
LDAP does not concern the average adolescent :); in either case, perhaps you
might be able and not entirely bored to read more than a few pages:

http://www.catb.org/~esr/faqs/smart-questions.html

Let this be your guide in your travels in Usenet.  Show you did your
"homework" before asking others.

You see, imagine yourself after about 15-20 years of using computers and
discussing them with others (in private or on the internet), and new people
keep coming all the time asking the same questions that have been discussed,
answered and beaten to death dozens of times before.  Steve's using
computers for longer than that, and he bothered at least to tell you the
obvious step you didn't take: to google your question so you find the
previous related discussions.

You should thank him for offering his time, because his reply was helpful
even if you don't understand it; he directed you to the whereabouts of the
answer to your question.  Ask groups.google about

group:comp.lang.python ldap

and work your way from there.  When you come back here after you've grokked
the "Smart Questions" document, I (and Steve I am sure, and lots of others
who didn't bother to reply as Steve did) will be more than glad to help you
further your knowledge of Python.

Cheers, btaranto.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Helpful replies (was Re: python-ldap)

2006-02-14 Thread Christos Georgiou
On Tue, 07 Feb 2006 12:36:11 -0500, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

>[EMAIL PROTECTED] wrote:
>> y0!
>>
>> 
>> 
>> tks!
 
>gOOgl3, man
>
>PS: We tend to speak English here :-)

Actually, we tend to speak whatever language the OP's experience suggests. 

I remember the other day, some Humphrey Bogart asked "Are there any waters
in Casablanca?" and some smart-_)_ replied "You know how to google, don't ya
honey?  You just put the little words together and... click search."

I ain't sure if Bogey eventually looked it up.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unexpected behaviour of getattr(obj, __dict__)

2006-02-16 Thread Christos Georgiou
On Tue, 14 Feb 2006 22:24:12 -0500, rumours say that "Terry Reedy"
<[EMAIL PROTECTED]> might have written:

> id(Parrot.f) == id(Parrot.f)
>> True
> id(Parrot.__dict__) == id(Parrot.__dict__)
>> True
>
>A wrapper is created and passed to id() which returns an int object while 
>releasing the wrapper back to the free list.  Then another wrapper is 
>created in the same chunk of memory and passed to id, which returns an int 
>of the same value for comparison.  The language ref only guarantees 
>uniqueness of ids at any particular instant and allows reuse of ids of 
>deallocated objects.
>
>I half seriously think the lib ref entry for id() should have a warning 
>that naive use can mislead.

Actually, you more-or-less just wrote what could (I also think should) be
included in the docs.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fighting Spam with Python

2005-08-26 Thread Christos Georgiou
On Wed, 24 Aug 2005 22:46:28 -0700, rumours say that David MacQuigg  might have written:

>I'm writing some scripts to check incoming mail against a registry of
>reputable senders, using the new authentication methods.  Python is
>ideal for this because it will give mail-system admins the ability to
>experiment with the different methods, and provide some real-world
>feedback sorely needed by the advocates of each method.  So far, we
>have SPF and CSV.  See http://purl.net/macquigg/email/python for the
>latest project status.

I am on the side of advocating SPF records --and I am one of the first
four postmasters in my country's TLD that set up SPF records for two of
the email domains I'm administrating.  SPF is an internet draft now.[1]

Your method is/will_not be free (as in beer), as hinted in
http://www.ece.arizona.edu/~edatools/home/email/registry/Form-Sender01.htm
.  *That* is a drawback similar to the licensing of the Microsoft's
Sender/Caller-ID scheme.  Why not support open, free standards?

I have developped scripts of my own to perform various consistency
checks (including SPF lookup) and maintain my own black list (I am
consulting three RBL's which I have found to be close to my standards,
but I want to avoid excessive usage of their bandwidth), and although it
takes some time almost every day overseeing things, I would be very
timid to support such a free (as in jazz :) scheme.  I mean, the
"reputation" idea is nice, but paying for this reputation won't help its
spreading.

Good luck with it as a business, though.


[1]
http://www.ietf.org/internet-drafts/draft-schlitt-spf-classic-02.txt
http://www.ietf.org/internet-drafts/draft-newton-maawg-spf-considerations-00.txt
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decline and fall of scripting languages ?

2005-08-26 Thread Christos Georgiou
On 16 Aug 2005 01:32:16 -0700, rumours say that Paul Rubin
 might have written:

>Erlang apparently uses microthreads,
>probably allocating every call frame on the heap like SML/NJ did, so
>they showed it with 80,000 connections open.

This is 8 TCP/IP v4 connections open?
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python library/module for MSAccess

2005-08-27 Thread Christos Georgiou
On Sat, 27 Aug 2005 04:45:25 GMT, rumours say that Stephen Prinster
<[EMAIL PROTECTED]> might have written:

>Jonathon Blake wrote:
>
>> [ Editing/creating msaccess databases on a Linux Box, and WINE _not_ 
>> installed.]
>
>I'm pretty sure I don't understand what you are wanting to do.  You say
>you have   "msaccess databases on a Linux Box" and you are not using the
>Jet Database engine.  As far as I know, MS Access is just a front-end to
>databases, with Jet as the default backend (though it can connect to
>many others).  What backend database engine/storage format are you
>using?  There might be a python library for connecting to it, bypassing
>Access altogether.

I think the OP wants to *use* .mdb files on a linux system without using
any msjet*.dll libraries.

There is a (C language) project that can read .mdb databases-- it can't
write them yet.[1]


[1] http://mdbtools.sourceforge.net/
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compiled?

2005-09-06 Thread Christos Georgiou
On Tue, 06 Sep 2005 03:06:52 -, rumours say that Grant Edwards
<[EMAIL PROTECTED]> might have written:

>There are very, very few pure "exe"
>single-file executable windows apps.  Putty is the only one
>I've run across in a _long_ while.

Then you should also run across Media Player Classic (download it from
http://sourceforge.net/projects/guliverkli ).  Just a plain exe, no
installation needed, and is an excellent media player.  For a funny
side, check the program's version history.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simple question: $1, $2 in py ?

2005-09-06 Thread Christos Georgiou
On Mon, 05 Sep 2005 12:54:35 +0200, rumours say that "Diez B. Roggisch"
<[EMAIL PROTECTED]> might have written:

>> 
>> As far as I understand there's no $1, $2... etc stuff right ?
>
>Yes - but there is sys.argv
>
>Try this
>
>
>import this

>print sys.argv


I believe this last line should be:

print this.__builtins__['__import__']('sys').argv
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: determine if os.system() is done

2005-09-08 Thread Christos Georgiou
On Wed, 07 Sep 2005 23:28:13 -0400, rumours say that Peter Hansen
<[EMAIL PROTECTED]> might have written:

>Martin P. Hellwig wrote:
>> The only thing I am disappointed at his writing style, most likely he 
>> has a disrupted view on social acceptable behavior and communication.
>> These skills might be still in development, so perhaps it is reasonable 
>> to give him a chance and wait until he is out of his puberty.

>He's 37 years old!  How long should one be given to mature?

I (lots of female friends, actually :) believe many men remain in
puberty for longer than that.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-26 Thread Christos Georgiou
On Tue, 20 Sep 2005 16:48:41 +0200, rumours say that Piet van Oostrum
<[EMAIL PROTECTED]> might have written:

>And most smtp servers that I know also pass mail from any from-address to
>any to-address if the IP number of he client machine belongs to a trusted
>range (usually the range that belongs to the ISP). So I can send both my
>private mail and my work mail from both my home ISP's smtp server and my
>work's smtp server (but only if I am at the proper location).

You might start having troubles, though, as soon as SPF checks get more
widespread.

Say your work mail is [EMAIL PROTECTED], and your private mail is
[EMAIL PROTECTED]; if you send email through your office mail server
with the envelope "MAIL FROM: [EMAIL PROTECTED]", then some (and
eventually many) receiving servers shall ask yagoohoogle.com for their
SPF record, and since your office mail server won't probably show up as
a valid email sender from yagoohoogle.com , your email will get
rejected.

That's a good thing.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about smtplib, and mail servers in general.

2005-09-26 Thread Christos Georgiou
On Wed, 21 Sep 2005 07:50:26 +0100, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

>I agree that there's an element of the moral imperative in my assertion 
>that the mails "should" go through which is largely ignored by the real 
>world nowadays. Some ISPs force you to use their SMTP servers no matter 
>what the sending domain, which is rather annoying when you travel a lot. 
>I end up having to vary my default SMTP server as I move.

...or set up your email client to always connect to localhost ports eg
31025 and 31110, and then from wherever you are, you connect to an SSH
server trusted by your "standard" mail server and port-forward to it.

Don't know if this applies to your case, but it works for me :)
-- 
Christos Georgiou, Customer Support Engineer
Silicon Solutions, Medicon Ltd.
Melitonos 5, Gerakas 153 44 Greece
Tel +30 21 06606195 Fax +30 21 06606599 Mob +30 693 6606195
"Dave always exaggerated." --HAL
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 1 Million users.. I can't Scale!!

2005-09-30 Thread Christos Georgiou
On Wed, 28 Sep 2005 21:58:15 -0400, rumours say that Jeff Schwab
<[EMAIL PROTECTED]> might have written:

>For many (most?) applications in need of 
>serious scalability, multi-processor servers are preferable.  IBM has 
>eServers available with up to 64 processors each, and Sun sells E25Ks 
>with 72 processors apiece.

SGI offers modular single-image Itanium2 servers of up to 512 CPU at the
moment:

http://www.sgi.com/products/servers/altix/configs.html

And NASA have clustered 20 of these machines to create a 10240 CPU
cluster...

>I like to work on those sorts of machine 
>when possible.  Of course, they're not right for every application, 
>especially since they're so expensive.

And expensive they are :)
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Moronicity of Guido van Rossum

2005-09-30 Thread Christos Georgiou
On Fri, 30 Sep 2005 07:50:45 +1000, rumours say that "Delaney, Timothy
(Tim)" <[EMAIL PROTECTED]> might have written:

>You have to admit though, he's remarkably good at getting past
>Spambayes. Despite classifying *every* Xah Lee post as spam, he still
>manages to get most of his posts classified as 0% or 1% spam.

IIRC this is because spambayes takes account of mostly spelling
misteaks; if syntax mistakes mattered as much, he would be classified as
spam more easily.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] Any Python lullabies?

2006-04-18 Thread Christos Georgiou
Since there have been python limmericks, are there any Python lullabies that
I can sing to my newborn son (actually, born yesterday)?  I tried to murmur
some select parts from the tutorial, but he somehow wasn't very interested
:)
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Shell like syntax for subprocess.Popen # overloading >, <, |

2006-04-18 Thread Christos Georgiou
On 18 Apr 2006 01:37:03 -0700, rumours say that "jelle"
<[EMAIL PROTECTED]> might have written:

>Hi,
>
>I use python quite a bit to couple different programs together.
>Doing so has been a _lot_ easier since subprocess came around, but
>would really like to be able to use the succinct shell syntax; >, <, |
>
>That really shouldn't be too hard to wrap in a class, but so far I
>didn't succeed to do so this well, since I'm facing some trouble with
>operator precedence that I do not know how to overcome.

[snip]

Overload the __or__ special function (ie the 'pipe' operator) instead of the
__gt__ operator.

I remember I have seen such a proposition (mentioning pump, filters and
sinks) but I couldn't find it in google.groups.com --I think Aahz had
something to do with it, but ICBW.

Ah, I found it:

http://mail.python.org/pipermail/python-dev/2004-April/044205.html

I don't know why I remembered Aahz about it :)

Check this too:

http://groups.google.gr/group/comp.lang.python/browse_thread/thread/674a821ed7003b69/777efd4d3aa490ed?lnk=st&q=python+overload+pipe+syntax&rnum=1&hl=en#777efd4d3aa490ed
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Shell like syntax for subprocess.Popen # overloading >, <, |

2006-04-19 Thread Christos Georgiou
On 18 Apr 2006 05:00:55 -0700, rumours say that "jelle"
<[EMAIL PROTECTED]> might have written:

>Hi Christos,
>
>Thanks for your pointers there, impressive to see
>-that a 12 year old thread still can make an interesting read
>-you being able to remember & trace it... impressive...
>
>Thanks for your pointers.
>I think the
>input > process > output
>Syntax is more powerful , since it would let you build chaining
>commmands in a more readable fashion.
>
>The goal of this class would be to construct command chains such as:
>
>input > processA | processB > ouput
>
>Something which wouldn't be possible if only one operator is
>overloaded.
>I'm curious to see if its doable via overloading, since no __rgt__
>methods exists...

The problem with the operators chaining is that ">" is treated differently
than "|".  Check the following disassembly:

>>> import dis
>>> dis.dis(compile("a>   24 ROT_TWO 
 25 POP_TOP 
>>   26 RETURN_VALUE
>>> dis.dis(compile("a|b|c", "", "eval"))
  0   0 LOAD_NAME0 (a)
  3 LOAD_NAME1 (b)
  6 BINARY_OR   
  7 LOAD_NAME2 (c)
 10 BINARY_OR   
 11 RETURN_VALUE


The comparison operators include some logic in order to "do what I mean" (so
that 4" operator, just don't chain it, in order to
avoid such unexpected behaviour.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: returning none when it should be returning a list?

2006-05-02 Thread Christos Georgiou
On 1 May 2006 07:19:48 -0700, rumours say that [EMAIL PROTECTED] might
have written:

>I'm not sure what "falls off the end" of the function means, i searched
>online, it seems to mean that the function has reached the end
>prematurely and returned a default identifier to signal success or
>not.. Can you please explain what that means?

I think that you haven't grasped the fact that a chain of calls of a
recursive function needs a return for *every* invocation of the function
(but I could be wrong :)

Check the following function, analogous to your own:

>>> def f(x):
if x > 4:
print "   returning", x
return x
else:
print "   start recursion"
f(x+1)
print "   end recursion"


>>> print f(0)
   start recursion
   start recursion
   start recursion
   start recursion
   start recursion
   returning 5
   end recursion
   end recursion
   end recursion
   end recursion
   end recursion
None

Do you see why the function returns None?
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: resume picking items from a previous list

2006-05-02 Thread Christos Georgiou
On 30 Apr 2006 05:33:39 -0700, rumours say that "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> might have written:

>
>kpp9c wrote:

>> For a time i pick from my songs, but i only play a few of the songs in
>> that list... now my wife, Jessica Alba, comes home, and i start playing
>> from Jessica's list of songs. After playing a few songs, Jessica, who
>> needs her beauty sleep, goes to bed, and i start my play loop which
>> starts picking from my songs again...

>Not sure I follow. Jessica goes to bed, and you... _listen to music_??

He said his *wife*, Jessica Alba.  There's *no* way you marry *anyone* you
won't get bored of eventually.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: returning none when it should be returning a list?

2006-05-02 Thread Christos Georgiou
On 2 May 2006 03:03:45 -0700, rumours say that "Iain King"
<[EMAIL PROTECTED]> might have written:


>John Machin wrote:
>>
>> # Doh! Looks like recursion not necessary. Google 'eliminate tail
>> recursion' :-)

>
>I did, and found this:
>http://www.biglist.com/lists/dssslist/archives/199907/msg00389.html
>which explains that the Scheme compiler optimises (obvious) tail
>recursion into iterative code.  I'm wondering if the python compiler
>does the same?

No, it doesn't so far.

More info:

http://groups.google.com/groups/search?q=group%3Acomp.lang.python+tail+recursion+optimization&qt_s=Search>
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: redemo.py with Tkinter

2006-05-03 Thread Christos Georgiou
On 03 May 2006 06:05:46 +1000, rumours say that Gary Wessle
<[EMAIL PROTECTED]> might have written:

>I was reading the Regular Expression HowTo, it refers to redemo.py if
>you have Tkinter installed. a quick #locate redemo.py returned none on
>my debian/testing, however #locate Tkinter returned many.
>any body out there is using it, is it a separate download?

The easiest way is to download it directly from subversion:

http://svn.python.org/view/python/trunk/Tools/scripts/

Click on the number link right next to redemo.py, and then you can click the
"download" link.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simultaneous assignment

2006-05-03 Thread Christos Georgiou
On Tue, 02 May 2006 17:15:05 GMT, rumours say that John Salerno
<[EMAIL PROTECTED]> might have written:

>Another thing I'm trying to do is write a function that tests to see if 
>a list contains exactly one true item, and the rest are false (obviously 
>this would have to be a list of boolean values, I guess). I'm sure this 
>isn't a handy utility, but I enjoy figuring out how to implement it.

>>> def true_count_is(predicates, count):
return count == sum(map(bool, predicates))

>>> true_count_is([True, True, False], 1)
False
>>> true_count_is([True, False, False], 1)
True
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


PyPornography was: Re: Python vs. Lisp -- please explain

2006-02-28 Thread Christos Georgiou
On Tue, 21 Feb 2006 15:05:40 -0500, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

>Chris Mellon wrote:
>[...]
>> Torstens definition isn't useful for quantifying a difference between
>> interpeted and compiled - it's a rough sort of feel-test. It's like
>> how much of a naked body you can expose before before it changes from
>> art to pornography - it's not something that is easily quantified.
>> 
>[...]

>Possibly, but if your aim is exposing as much flesh as possible without 
>being labeled pornography I think I'd conclude you were in the 
>pornography business from the start, albeit masquerading as an "art dealer".

The difference between art and pornography, as I perceive it, is that you
don't have to think about it when you see pornography.  You can even turn
off the audio in cinematographic/video pornography and still the message
comes through (in the vague lines of "jerk off along").

So, in pornography there's no interpretation step involved; therefore, by
pure logic, all "compiled to machine code" languages should be looked down
upon as pornographic, and Python is art.  QED.


PS You (the READER) are licensed to substitute other "non compiled to
machine code" languages for Python (the PROGRAM) in the previous paragraph,
just do it outside comp.lang.python (the COMPANY).  We don't care what you
do late at night with *your* object of desire, whatever that may be, since
it's not Python.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: spaces at ends of filenames or directory names on Win32

2006-03-02 Thread Christos Georgiou
On Thu, 23 Feb 2006 17:49:31 -0600, rumours say that Larry Bates
<[EMAIL PROTECTED]> might have written:

>IMHO leading and/or trailing spaces in filenames is asking for
>incompatibilities with cross-platform file access.  Much like
>using single-quote in filenames which are perfectly legal in
>DOS/Windows, but Linux doesn't like much.

Just for those who don't know, in general *nix operating systems (and the
various *nix file systems) disallow only '\0' and '/' in filenames.  The '/'
because obviously is the path separator, and '\0' because it's the
end-of-string marker in C.

When Larry said "Linux", he actually meant the shell he uses.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 354: Enumerations in Python

2006-03-03 Thread Christos Georgiou
On 26 Feb 2006 22:30:28 -0800, rumours say that "Crutcher"
<[EMAIL PROTECTED]> might have written:

>This seems great, except why can't I compare strings? It seems too
>useful when dealing with user input, or parsing messages or config
>files.
>
 Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat')
 Weekdays.mon.__cmp__('mon')

some_value = Weekdays.thu
...
user_input = raw_input("Enter day name")
if user_input == str(some_value):

>Additionaly, perhaps the call method of the enumeration object should
>construct a value from strings?
 Weekdays.mon == Weekdays('mon')

Either way works for me.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to Mount/Unmount Drives on Windows?

2006-03-04 Thread Christos Georgiou
On 25 Feb 2006 18:06:15 -0800, rumours say that [EMAIL PROTECTED] might
have written:

>Hello,



>I do not know how to mount or unmount drives on Windows. I think that
>it could possibly be done with a DOS command (using os.system()).

mountvol is the command you want.  I know it's in winxp, I think it was in
win2k too.

Check the Windows Help for its usage.

PS another command that is most useful is netsh, especially for laptops.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Making a tiny script language using python: I need a string processing lib

2006-03-04 Thread Christos Georgiou
On 2 Mar 2006 17:53:38 -0800, rumours say that "Sullivan WxPyQtKinter"
<[EMAIL PROTECTED]> might have written:

>I do not know if there is any lib specially designed to process the
>strings in scipt language.
>for example:
>I hope to process the string"print a,b,c,d,e "in the form"command
>argumentlist" and return:
>{'command'='print',
>'argumentlist'=['a','b','c','d','e']}

Have you checked the shlex module in the standard library?  It might be
useful.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: It is fun.the result of str.lower(str())

2006-03-07 Thread Christos Georgiou
On Tue, 07 Mar 2006 10:23:59 +0100, rumours say that bruno at modulix
<[EMAIL PROTECTED]> might have written:



>Now would you be kind enough to explain what's funny about all this ?

I would guess it's the statement: "Funny, it works!"
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Send email notification

2006-03-08 Thread Christos Georgiou
On Wed, 08 Mar 2006 06:20:42 +, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

> If we 
>weren't paid thousands of dollars a week to answer questions on this 
>list we'd probably get snarky more often.

Steve, please, don't make me look like a liar in front of the children!
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheese Shop -> BSOL?

2006-03-16 Thread Christos Georgiou
On 11 Mar 2006 03:22:42 -0800, rumours say that "Paul Boddie"
<[EMAIL PROTECTED]> might have written:

>Tim Churches wrote:

>> Would it be possible to rename "Cheese Shop" as "Bright Side of Life"?

[Paul]


>So should a service for finding Python packages have a distinct
>identity? It is possible that a package index could be someone's
>principal view of the Python world ("I go to Camelot to get... what is
>it I get there?"), but the things that emerge from such a service
>aren't just downloads that have little in common with each other.
>Consequently, I don't think a descriptive name, derived from the name
>of the technology, is sensibly avoided in this case.

I like the BSOL idea, but in that case what will the package extension be
instead of .egg?  camelot.python.org has the advantage of suggesting an
obvious extension: .graal

So you go to the Camelot to get the graal (or one of them :).  In case this
catches on, I'd like to upload ASAP one of my packages [1] called "wholy".

PS "Grail" was a web browser written in Python (or an attempt at one).


[1] It's mostly useless but I trust wholy.graal will be downloaded by
millions.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheese Shop: some history for the new-comers

2006-03-18 Thread Christos Georgiou
On Sun, 12 Mar 2006 20:15:19 -0600, rumours say that Ron Adam
<[EMAIL PROTECTED]> might have written:

>[EMAIL PROTECTED] wrote:
>
>Cheese (or the lack of cheese) is never silly,  Thus the slogan... "The 
>power of cheese".
>
>Now if you want silliness, then the correct establishment for that is 
>"The Ministry of Silly Walks". ;)

The Ministry was definitely a Cleese shop.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File Permissions

2006-03-18 Thread Christos Georgiou
On Fri, 10 Mar 2006 16:43:15 +0200, rumours say that Juho Schultz
<[EMAIL PROTECTED]> might have written:

>VJ wrote:
>> Hi All
>> 
>> Basically i want to write into a file .If the permissions are not there
>> then print a error message.
>> How do i achive this ???
>> 
>> Thanks,
>> VJ
 
>One way would be a try-except block, and leave the permission checking 
>error message generation, etc. to the operating system.
>
>try:
> outfile = file(outfilename,"w")
>except IOError, errormsg
> print "Could not write to file %s: %s" % (outfilename, errormsg)

As a word of caution: the OP is checking for the permissions of an
*existing* file.  Both Juho's and Sybren's suggestions *destroy* the file's
contents.

So, VJ, I'd suggest the following change:

Open the file for read write

outfile= open(outfilename, "r+b") # I assume binary

and later on catch errors in .write operations.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Adding Multiple Attachments to SMTP mail (msg.add_header)

2006-03-18 Thread Christos Georgiou
On 10 Mar 2006 06:08:37 -0800, rumours say that "EdWhyatt"
<[EMAIL PROTECTED]> might have written:

>I attach my code for passing the information to  msg.add_header:
>
>(AttNum = 2)
>
>for doatt in range(AttNum):
>msg.add_header('Content-Disposition', 'attachment',
>filename=ATTselection[doatt])
>doatt = doatt + 1
>outer.attach(msg)
>
>..
>body = MIMEText(Text)
>outer.attach(body)
>
>Like I said, it is correctly sending the 2 seperate files from my
>ATTselection array, but ultimately attaching the last file twice.

The {doatt = doatt + 1} line is unneeded in the {for doatt in} loop.  This
*might* be your problem, I didn't delve any deeper.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Find similar images using python

2006-03-31 Thread Christos Georgiou
On 29 Mar 2006 05:06:10 -0800, rumours say that "Thomas W"
<[EMAIL PROTECTED]> might have written:

>How can I use python to find images that looks quite similar? Thought
>I'd scale the images down to 32x32 and convert it to use a standard
>palette of 256 colors then compare the result pixel for pixel etc, but
>it seems as if this would take a very long time to do when processing
>lots of images.

I see someone suggested imgseek.  This uses a Haar transform to compare
images (check on it).  I did make a module based on imgseek, and together
with PIL, I manage my archive of email attachments (it's incredible how many
different versions of the same picture people send you: gif, jpg in
different sizes etc) and it works fairly well.

E-mail me if you want the module, I don't think I have it currently online
anywhere.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ipv6 validation

2006-04-02 Thread Christos Georgiou
On 30 Mar 2006 11:40:08 -0800, rumours say that [EMAIL PROTECTED]
might have written:

>thanks a lot for this solution.
>Next thing: how may i find out that that address is multicast one? is
>there some easy possibility or i have to use regex now?

To quote a Google reply:

"IPv6 multicast addresses are distinguished from unicast addresses by the
value of the high-order octet of the addresses: a value of 0xFF (binary
) identifies an address as a multicast address; any other value
identifies an address as a unicast address."
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Find similar images using python

2006-04-04 Thread Christos Georgiou
On Fri, 31 Mar 2006 15:10:11 -0800, rumours say that Scott David Daniels
<[EMAIL PROTECTED]> might have written:

>Christos Georgiou wrote:
>>  I did make a module based on imgseek, and together with PIL,
>> I manage my archive of email attachments (it's incredible how many
>> different versions of the same picture people send you: gif, jpg
>> in different sizes etc) and it works fairly well.
>> 
>> E-mail me if you want the module, I don't think I have it currently online
>> anywhere.

>This sounds like a great recipe for the cookbook:
> http://aspn.activestate.com/ASPN/Cookbook/Python

Actually, it should go to the CheeseShop, since it is a python module that
is a bridge between PIL and the C module (I don't believe multi-file modules
are appropriate for the cookbook, but ICBW); however, my web space is out of
reach for some months now (in a web server at a previous company I worked
for), and I'm in the process of fixing that :)
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "The World's Most Maintainable Programming Language"

2006-04-08 Thread Christos Georgiou
On Fri, 07 Apr 2006 11:11:14 +0200, rumours say that Azolex
<[EMAIL PROTECTED]> might have written:

>>   At-least Pythetic isn't a word (yet).
>> 
>
>:))) "now that's quite pythetic !"

Well, "pythetic" could become a synonym to "un-pythonic".
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: GUI Treeview

2006-04-08 Thread Christos Georgiou
On Fri, 7 Apr 2006 22:52:06 +0200, rumours say that "Arne"
<[EMAIL PROTECTED]> might have written:


>"Peter Hansen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
>news:[EMAIL PROTECTED]

>> Arne wrote:
>>> Hello !
>>>
>>> I am looking for a widget with the following properties:
>>> - showing the tree file structure/ directory structure
>>> - next to each file should be a checkbox
>>> - the tree should only show certain files (i. e. only for the looked in 
>>> user)

>> For which GUI framework?  (e.g. Tkinter, wxPython, etc...)

>If possible for the Tkinter frameworkt.

There's a TreeWidget.py module in idlelib, which you can modify to your
needs.  There's also the Tix.Tree widget, if you have Tix installed (and you
probably do if you run a recent Python on your Windows box), which also is
very powerful.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorators, Identity functions and execution...

2006-04-10 Thread Christos Georgiou
On Sun, 09 Apr 2006 11:42:34 -0300, rumours say that Jorge Godoy
<[EMAIL PROTECTED]> might have written:

>Indeed.  This is correct.  Fredrick's comment was related to the lack of
>indentation in your code.

His code was indented fine, as you maybe noticed later on.  The actual
problem was that he had tabs, so Fredrik's Outlook Express (and I guess
other newsreaders too) did not show indentation.

Fredrik suggested already the typical "use spaces, not tabs"; I just thought
that "lack of indentation" was unfair for the OP.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.0 or Python 3000?

2006-04-10 Thread Christos Georgiou
On 9 Apr 2006 20:32:07 -0700, rumours say that "Ray" <[EMAIL PROTECTED]>
might have written:

>Dennis Lee Bieber wrote:
>>  Or... just to save "3000" as a "time way down the road"... The next
>> major version of Python will be: Python PI (and each build will add
>> another digit... "3.1, 3.14, 3.141, ...")
>
>I like this idea a lot. This way, people ALWAYS know what the next
>release's name will be.

Who gave the time machine to the Donald Knuth?  Have we got infiltrators?
Or did he steal it?

In other news, the unnamed chief of the PSU has stat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.0 or Python 3000?

2006-04-10 Thread Christos Georgiou
On Sun, 9 Apr 2006 22:15:15 -0400, rumours say that "Tim Peters"
<[EMAIL PROTECTED]> might have written:

>[John Salerno]
>> Is 'Python 3000' just a code name for version 3.0, or will it really be
>> called that when it's released?

>The smart money is on changing the name to Ecstasy, to leverage
>marketing publicity from the hallucinogenic club drug of the same
>name.  "class" will be renamed to "rave", and the license will be
>changed to prohibit use by people with bipolar disorder.

Anything to do with recent rumours about license change?  Will programming
in Python finally be outlawed, as it should be from the start (it's so
pleasing after all, it should be illegal)?  There will be a charge per line
(of code)?  Shall we become code sniffers?

>Either that, or the name will be Python 3.0.

That's what we, as cautious merchands dealing with unknown clients, should
call our product.  Excellent.

PS ("Mwa" + "ha"*sys.maxint) still won't work, though.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: waiting for file lock?

2006-04-11 Thread Christos Georgiou
On Tue, 11 Apr 2006 19:07:19 +1200, rumours say that Lawrence D'Oliveiro
<[EMAIL PROTECTED]> might have written:

>In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] wrote:
>
>>i need to go into a directory to grab some files and do some
>>processing.
>>The thing is, i need to wait till the process that generates the files
>>in that directory to finish
>>before i can grab the files. eg if file A is being generated and has
>>not finished, my python script will not go into the directory.
>>how can i check that file A has actually finished?

>I wrote a similar system that watches for new files arriving in an 
>"uploads" directory, whether copied there via FTP or using a GUI desktop 
>script. My heuristic was to only process files whose last-modified 
>date/time was at least 5 minutes in the past. My assumption was that it 
>was unlikely that 5 minutes would go by between more information being 
>added to a file.

This works (unless there are long network timeouts, when downloading...),
but another idea is to wait for the existence of a zero-byte sentinel file
that is created last, after the transfer (or process, in general) has ended.

This method is the one that has worked best for me.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorators, Identity functions and execution...

2006-04-11 Thread Christos Georgiou
On Tue, 11 Apr 2006 15:05:22 +1200, rumours say that Lawrence D'Oliveiro
<[EMAIL PROTECTED]> might have written:

>In article <[EMAIL PROTECTED]>,
> Roy Smith <[EMAIL PROTECTED]> wrote:
>
>>One of the most basic 
>>maxims on the Internet has always been, "Be liberal in what you accept, be 
>>conservative in what you produce".

>How do you explain top-posting, then?

“Be lazy and let your news/mail client choose for you.”

Unless you meant “how do you explain top-posting *acceptance* by non
top-posters.”  That is another branch of psychology.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Compleated Begginers Guide. Now What?

2006-04-12 Thread Christos Georgiou
On Tue, 11 Apr 2006 07:37:23 -0400, rumours say that Steve Holden
<[EMAIL PROTECTED]> might have written:

>James Stroud wrote:

>> Mirco Wahab wrote:
 
>>>Jay wrote:

>>>Malchick, you cracked your veshchs to classes, which is
>>>not that gloopy. So rabbit on them and add class methods
>>>that sloosh on beeing called and do the proper veshchs
>>>to the gulliwuts of their classes.
 
>> Brillig!
 
>But neither helpful nor sympathetic.

Neither sympythetic, too (where “sympythetic” is the typical behaviour on
c.l.py)
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: datetime: the date of the day one month ago...how?

2006-04-12 Thread Christos Georgiou
On Wed, 12 Apr 2006 13:42:15 +0200, rumours say that gabor
<[EMAIL PROTECTED]> might have written:

>i want the day that you get by intutively saying "one month ago". means 
>usually picking the same day in the previous month. if that day does not 
>exist, i want the nearest day that exist and was BEFORE the nonexistent day.
>
>one-month-ago(31.mar.2006) = 28.feb.2006
>one-month-ago(28.feb.2006) = 28.jan.2006

def submonth(d):
year, month= d.year, d.month
if month == 1:
year-= 1; month= 12
else:
month-= 1
try:
return d.replace(year=year, month=month)
except ValueError:
return d.replace(day=1) - datetime.timedelta(1)


>>> submonth(datetime.date(2006,3,31))
datetime.date(2006, 2, 28)
>>> submonth(datetime.date(2006,2,28))
datetime.date(2006, 1, 28)

-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: trouble with Tkinter and Tix

2006-04-12 Thread Christos Georgiou
On 11 Apr 2006 14:39:41 -0700, rumours say that "CT" <[EMAIL PROTECTED]>
might have written:

>I installed python 2.4.3, Tcl 8.4 Tk8.4 and also with Tix 8.4

>I got some error like _tkinter.TclError:ambigous option "-col": must be
>column, etc with my LabelFrame from Tix.
>
>It seems that the python interpreter is mixing my Tix with Tkinter? If
>I put Tix.LabelFrame and use import Tix instead of from Tix import *,
>the problem seems to be gone.
>
>Any idea how to fix it without editing all the codes?

Please post a part of the code that illustrates this misbehaviour.  Also try
to describe what you are trying to do.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Figure out month number from month abbrievation

2006-04-12 Thread Christos Georgiou
On 12 Apr 2006 13:20:28 -0700, rumours say that "Bill"
<[EMAIL PROTECTED]> might have written:

>Hello --
>I'm parsing the output of the finger command, and was wondering
>something...If I'm given a month abbrievation (such as "Jan"), what's
>the best way to figure out the month number?

Try

import time
help(time.strftime)

and then this *might* work for you:

month_as_string= "Jan"
time.strptime(month_as_string, "%b").tm_mon

"Localization" (as Fredrik also suggested) is the reason for the *might* in
my previous sentence.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: symbolic links, aliases, cls clear

2006-04-12 Thread Christos Georgiou
On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson"
<[EMAIL PROTECTED]> might have written:

>>>I still have a system which does not have tput.
>>
>> And that justifies everything else. Of course.
>
>   If I want to write portable scripts, then yes, it does.

Well, either port your system out of the window or port tput.c to your
system and then start writing "portable" scripts.  tput is part of the POSIX
1003.1 standard, and guess what the 'P' stands for in POSIX.

If you insist, I will retort to using Terry Pratchett references.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list