Pygments 1.0 Dreiundzwanzig released

2008-11-23 Thread Georg Brandl
I've just uploaded the Pygments 1.0 packages to CheeseShop. Pygments is a generic syntax highlighter written in Python. Download it from http://pypi.python.org/pypi/Pygments, or look at the demonstration at http://pygments.org/demo. Many thanks go to Tim Hatch for writing or integrating many of

Sphinx 0.5 released

2008-11-23 Thread Georg Brandl
Hi all, I'm proud to announce the release of Sphinx 0.5 - Birthday edition! [1] What is it? === Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of multiple reStructuredText source files). Its

sqlkit 0.8.3.3

2008-11-23 Thread sandro
I'm please to announce rel 0.8.3.3 of sqlkit. It contains an important change in the import that was needed to have back the functionality of gtk debug [1] ( and to allow from sqlkit import db.proxy from command line when you don't have a display) from now on SqlMask and SqlTable are import from

Re: redirecting stdout/err to mysql table

2008-11-23 Thread John Nagle
Aleksandar Radulovic wrote: On Tue, Nov 18, 2008 at 7:07 PM, n00b [EMAIL PROTECTED] wrote: greetings, i need to log to the db directly and wrote a little script to do so. since i'm pretty new to python, i was wondering if a) you could review the enclosed code and b) provide suggestions to

how to detect if a dictionary has been modified ?

2008-11-23 Thread Stef Mientki
hello, Just like in a normal text editor, I would like to detect if a dictionary has been changed. So I would like to have a modified-flag. (This dictionary is used as a communication channel between processes) Now I do it to make a copy of the dictionary and compare it with the old one. When

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Arnaud Delobelle
Aaron Brady [EMAIL PROTECTED] writes: Truth and clarity are not tired of this thread. This is such a marvellously economic way of putting it, it's poetic! -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread bearophileHUGS
Stef Mientki: I would like to detect if a dictionary has been changed. So I would like to have a modified-flag. A solution is of course to create a SDict class, that works like a normal dict, and also watches for changes and has an extra boolean attribute. Bye, bearophile --

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2008 01:18:17 -0800, bearophileHUGS wrote: Stef Mientki: I would like to detect if a dictionary has been changed. So I would like to have a modified-flag. A solution is of course to create a SDict class, that works like a normal dict, and also watches for changes and has an

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Stef Mientki
Steven D'Aprano wrote: On Sun, 23 Nov 2008 01:18:17 -0800, bearophileHUGS wrote: Stef Mientki: I would like to detect if a dictionary has been changed. So I would like to have a modified-flag. A solution is of course to create a SDict class, that works like a normal dict, and

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Paul Rubin
Stef Mientki [EMAIL PROTECTED] writes: Now I do it to make a copy of the dictionary and compare it with the old one. When a change is detected I nake a new copy and interpret the whole new dictionary again, so I'm not interested in knowing where the change(s) are located. This works well,

Re: build minimal python 2.6 on linux

2008-11-23 Thread Jeremiah Dodds
On Sat, Nov 22, 2008 at 9:31 PM, r [EMAIL PROTECTED] wrote: And i know this may be asking alot but: where do i put the files before i run ./configure does it matter what directory there in?? any help here would be great since i am new to linux and have never built a python installation.

Re: build minimal python 2.6 on linux

2008-11-23 Thread Diez B. Roggisch
r schrieb: I would like to install minimal version if python 2.6 on a linux laptop (and no there is not one already installed...i checked) i have no way to access the net with the laptop. So basicly i down loaded the 2.6 source and unpacked it on my other PC. The files weigh in at 51MB and some

Re: imported method from module evaluates to None in some cases

2008-11-23 Thread Paul McGuire
On Nov 23, 4:21 am, Hrvoje Niksic [EMAIL PROTECTED] wrote: I don't know why the interpreter would shut down abruptly, but I suppose you could inspect the traceback to see what exactly caused the exception?- Hide quoted text - While you puzzle out the root cause, could something like this help

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread Arnaud Delobelle
Arnaud Delobelle [EMAIL PROTECTED] writes: (BTW, I think your earlier decorator had a bug, in that it failed to define __ne__ but then called self != other.) That would be true for Python 2.x but I'm explicitly writing code for Python 3 here, which, IIRC, infers != correctly when you define

Re: imported method from module evaluates to None in some cases

2008-11-23 Thread Peter Otten
Paul McGuire wrote: On Nov 23, 4:21 am, Hrvoje Niksic [EMAIL PROTECTED] wrote: I don't know why the interpreter would shut down abruptly, but I suppose you could inspect the traceback to see what exactly caused the exception?- Hide quoted text - While you puzzle out the root cause, could

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread bearophileHUGS
Paul Rubin: As a couple of people have said, you could make a dict subclass that notices when you do updates.  I think the real answer is a functional dictionary, which means one that is never updated. Python V. 2.4, 2.5, 2.6. 3.0 have gained more and more lazy-style features, this is changing

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread Arnaud Delobelle
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 22 Nov 2008 09:10:04 +, Arnaud Delobelle wrote: That's not surprising. You're measuring the wrong things. If you read what I wrote, you'll see that I'm talking about Fraction.__gt__ being slower (as it is defined in terms of

Re: imported method from module evaluates to None in some cases

2008-11-23 Thread Hrvoje Niksic
Andrew [EMAIL PROTECTED] writes: On Nov 20, 6:53 am, Hrvoje Niksic [EMAIL PROTECTED] wrote: Andrew [EMAIL PROTECTED] writes: I'm having a problem in some zope (2.10) code (HTTPResponse.py) where a method that gets imported somehow evaluates to None in certain cases which causes a

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Stefan Behnel
Steven D'Aprano wrote: What does the S stand for? The S stands for simple. http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

I cannot open images in g-mail

2008-11-23 Thread phastfred1
I use windows vista home premium. Whenever I open an incoming message in my inbox, no images are shown. Also, the option to display all images does not appear at the top of the message. The only option shown is display images below. When I click that option, nothing happens. I am guessing i must

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread George Sakkis
On Nov 23, 6:14 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: So how did I get it into my head that defining __eq__ would create the correct behaviour for __ne__ automatically?  And more puzzlingly, how come it is what actually happens?  Which should I believe: the documentation or the

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Derek Martin
On Tue, Nov 18, 2008 at 09:23:30AM +, Steven D'Aprano wrote: How I can answer the question, are the objects a and b the same or different? I can look at every aspect of each object, looking for something that is different. Well, sure, if you care *that much* about potentially trivial

Re: Building Python 2.5.2 for Itanium

2008-11-23 Thread Christopher
On Nov 21, 3:50 pm, Martin v. Löwis [EMAIL PROTECTED] wrote:   I need to compile that module for that release and platform, but I have been unable to discover which MS compiler version and runtime was used to generate the binaries.  My understanding is that Python 2.5.2 in general uses

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread Arnaud Delobelle
George Sakkis [EMAIL PROTECTED] writes: On Nov 23, 6:14 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: So how did I get it into my head that defining __eq__ would create the correct behaviour for __ne__ automatically?  And more puzzlingly, how come it is what actually happens?  Which should I

Windows, filename in right case, can it be done simpler ?

2008-11-23 Thread Stef Mientki
hello, when getting a breakpoint from pdb and similar packages, on Windows, the filename is given in lowercase. For the caption of my editor, I need the filename in the correct case. The function below does work reasonable well (path is not in the correct case), but I find it weird and much

Re: 404 not found on for Python 2.6 Itanium

2008-11-23 Thread Christopher
On Nov 21, 7:35 pm, r0g [EMAIL PROTECTED] wrote: Martin v. Löwis wrote: In any case, my concern with dropping a stock python itanium distro involves the vastly diminished probability that others will provide Itanium versions of, for example py2exe and pywin32. Well, I had been providing

Re: 404 not found on for Python 2.6 Itanium

2008-11-23 Thread Christopher
On Nov 21, 8:55 pm, Terry Reedy [EMAIL PROTECTED] wrote: Christopher wrote: Yes. It's too much effort to build, and too few users that actually use it. Users are still free to build it themselves, and to share the build with others. I guess that I don't understand why you feel there is

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Glenn Linderman
On approximately 11/23/2008 1:40 AM, came the following characters from the keyboard of Steven D'Aprano: On Sun, 23 Nov 2008 01:18:17 -0800, bearophileHUGS wrote Stef Mientki: I would like to detect if a dictionary has been changed. So I would like to have a modified-flag. A

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Steve Holden
Derek Martin wrote: [some stuff, followed by about 32k of unnecessarily quoted crap] It would be helpful if you'd take the time to trim your replies appropriately. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ --

Using dictionary to hold regex patterns?

2008-11-23 Thread Gilles Ganault
Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary to hold the patterns, and loop through it: == pattern = {} pattern[pattern1] =

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Arnaud Delobelle
Glenn Linderman [EMAIL PROTECTED] writes: On approximately 11/23/2008 1:40 AM, came the following characters from the keyboard of Steven D'Aprano: On Sun, 23 Nov 2008 01:18:17 -0800, bearophileHUGS wrote Stef Mientki: I would like to detect if a dictionary has been changed. So I would

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Arnaud Delobelle
Gilles Ganault [EMAIL PROTECTED] writes: Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary to hold the patterns, and loop through it:

Re: initialization in argument definitions

2008-11-23 Thread Terry Reedy
greg wrote: George Sakkis wrote: Don't worry, it's not obvious to *anyone* new to Python (and many not- so-new for that matter). That's by no means certain, because we only hear from the people who guessed the wrong way. We have no way of knowing how many people guessed the right way. I

Re: Windows, filename in right case, can it be done simpler ?

2008-11-23 Thread Martin v. Löwis
Does anyone has a better solution ? If you have pythonwin, you can use win32file.FindFilesW, passing the lower-cased file name. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Where is python.org? (was Re: Python 3 __cmp__ semantic change?)

2008-11-23 Thread Aahz
In article [EMAIL PROTECTED], Arnaud Delobelle [EMAIL PROTECTED] wrote: I can't refer you to the docs because my internet access to some US sites seems to be partly broken ATM, but here's a simple example: BTW, python.org is hosted at XS4ALL in the Netherlands, so if you can't reach it, it has

Re: 404 not found on for Python 2.6 Itanium

2008-11-23 Thread Martin v. Löwis
No criticism was intended. It was merely an RFI. Not sure whether you got the answer you wanted - when I said it is too much effort to build (and too few users), I really meant it is non-zero effort, which is too much. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread Terry Reedy
George Sakkis wrote: On Nov 23, 6:14 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: So how did I get it into my head that defining __eq__ would create the correct behaviour for __ne__ automatically? And more puzzlingly, how come it is what actually happens? Which should I believe: the

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Terry Reedy
Gilles Ganault wrote: Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary to hold the patterns, and loop through it: Good idea. import re

Re: Windows, filename in right case, can it be done simpler ?

2008-11-23 Thread Stef Mientki
Martin v. Löwis wrote: Does anyone has a better solution ? If you have pythonwin, you can use win32file.FindFilesW, passing the lower-cased file name. Thanks Martin, seems to work great. cheers, Stef Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list --

Re: Python 3 __cmp__ semantic change?

2008-11-23 Thread Arnaud Delobelle
Terry Reedy [EMAIL PROTECTED] writes: George Sakkis wrote: On Nov 23, 6:14 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: So how did I get it into my head that defining __eq__ would create the correct behaviour for __ne__ automatically? And more puzzlingly, how come it is what actually

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2008 09:24:05 -0600, Derek Martin wrote: On Tue, Nov 18, 2008 at 09:23:30AM +, Steven D'Aprano wrote: How I can answer the question, are the objects a and b the same or different? I can look at every aspect of each object, looking for something that is different.

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2008 09:19:38 -0800, Glenn Linderman wrote: Interesting technique. I must point out, though, that it doesn't indicate if a dict has been changed, only that potentially changing operations have been performed. [...] The above code would declare it has, but most people, when

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Gilles Ganault
On Sun, 23 Nov 2008 17:55:48 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: But there is no reason why you should use a dictionary; just use a list of key-value pairs: patterns = [ (pattern1, re.compile(.+?/td.+?(.+?)/td), Thanks for the tip, but... I thought that lists could only use

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Vlastimil Brom
2008/11/23 Gilles Ganault [EMAIL PROTECTED] Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary to hold the patterns, and loop through

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Benjamin Kaplan
On Sun, Nov 23, 2008 at 2:55 PM, Gilles Ganault [EMAIL PROTECTED] wrote: On Sun, 23 Nov 2008 17:55:48 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: But there is no reason why you should use a dictionary; just use a list of key-value pairs: patterns = [ (pattern1,

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread John Machin
On Nov 24, 6:55 am, Gilles Ganault [EMAIL PROTECTED] wrote: On Sun, 23 Nov 2008 17:55:48 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: But there is no reason why you should use a dictionary; just use a list of key-value pairs: patterns = [    (pattern1, re.compile(.+?/td.+?(.+?)/td),

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread John Machin
On Nov 24, 5:36 am, Terry Reedy [EMAIL PROTECTED] wrote: Gilles Ganault wrote: Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary

Re: I cannot open images in g-mail

2008-11-23 Thread Chris Rebert
This mailinglist is about the Python programming language, not Gmail; thus, your question is completely irrelevant. I would suggest you ask your question in http://groups.google.com/group/Gmail-Help-Discussion instead. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com On

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Thomas Mlynarczyk
John Machin schrieb: General tip: Don't us a data structure that is more complicated than what you need. Is [ ( name, regex ), ... ] really simpler than { name: regex, ... }? Intuitively, I would consider the dictionary to be the simpler structure. Greetings, Thomas -- Ce n'est pas parce

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread André
On Nov 23, 1:40 pm, Gilles Ganault [EMAIL PROTECTED] wrote: Hello After downloading a web page, I need to search for several patterns, and if found, extract information and put them into a database. To avoid a bunch of if m, I figured maybe I could use a dictionary to hold the patterns, and

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Glenn Linderman
On approximately 11/23/2008 9:50 AM, came the following characters from the keyboard of Arnaud Delobelle: Glenn Linderman [EMAIL PROTECTED] writes: On approximately 11/23/2008 1:40 AM, came the following characters from the keyboard of Steven D'Aprano: On Sun, 23 Nov 2008 01:18:17

Re: Redirecting warnings.showwarning to logging

2008-11-23 Thread Nick Coghlan
Tres Seaver wrote: Nick Coghlan wrote: Antoine Pitrou wrote: Brett Cannon brett at python.org writes: It is specifically there to be overridden (and as an aside, it was a pain to support in the C port of warnings), so it really isn't monkey-patching. =) Should we coin a new word for this?

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread John Machin
On Nov 24, 7:48 am, John Machin [EMAIL PROTECTED] wrote: On Nov 24, 5:36 am, Terry Reedy [EMAIL PROTECTED] wrote: print name + '#' + regex Perhaps you meant:    print key + # + regex.pattern I definitely meant: print name + '#' + regex.pattern --

Re: My first Python program -- a lexer

2008-11-23 Thread John Machin
On Nov 12, 2:54 am, Thomas Mlynarczyk [EMAIL PROTECTED] wrote: John Machin schrieb: You are getting closer. A better analogy is that using a dict is like transporting passengers along an autobahn in an aeroplane or helicopter that never leaves the ground. It is not a bad idea to

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread John Machin
On Nov 24, 7:49 am, Thomas Mlynarczyk [EMAIL PROTECTED] wrote: John Machin schrieb: General tip: Don't us a data structure that is more complicated than what you need. Is [ ( name, regex ), ... ] really simpler than { name: regex, ...}? Intuitively, I would consider the dictionary to be

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Gilles Ganault
On Sun, 23 Nov 2008 17:55:48 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: But there is no reason why you should use a dictionary; just use a list of key-value pairs: Thanks for the tip. I didn't know it was possible to use arrays to hold more than one value. Actually, it's a better solution,

Re: Need help converting text to csv format

2008-11-23 Thread r0g
John Machin wrote: On Nov 22, 11:04 am, r0g [EMAIL PROTECTED] wrote: On Nov 21, 10:18 am, Chuck Connors [EMAIL PROTECTED] wrote: Any help, pseudo code, or whatever push in the right direction would be most appreciated. I am a novice Python programmer but I do have a good bit of PHP

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread MRAB
Gilles Ganault wrote: On Sun, 23 Nov 2008 17:55:48 +, Arnaud Delobelle [EMAIL PROTECTED] wrote: But there is no reason why you should use a dictionary; just use a list of key-value pairs: Thanks for the tip. I didn't know it was possible to use arrays to hold more than one value.

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Gilles Ganault
On Sun, 23 Nov 2008 23:18:06 +, MRAB [EMAIL PROTECTED] wrote: A list is an ordered collection of items. Each item can be anything: a string, an integer, a dictionary, a tuple, a list... Yup, learned something new today. Naively, I though a list was index=value, where value=a single piece of

3.0rc3: 'os.extsep' gone ... ?

2008-11-23 Thread bMotu
IDLE 2.6 import os os.extsep '.' running XP this result is fine ... ! IDLE 3.0rc3 import os os.extsep Traceback (most recent call last): File pyshell#1, line 1, in module os.extsep AttributeError: 'module' object has no attribute 'extsep' why is this attribute gone in 3.0rc3 ? where

Re: how to detect if a dictionary has been modified ?

2008-11-23 Thread Stef Mientki
Good point. What about d = {1: []} d[1].append(2) Has d changed or not? Which just goes to show that the SDict implementation above is, as suspected by the author, incomplete for the purpose of detecting all changes to the dict, as well as detecting some that might not

CherryPy vs Bluehost

2008-11-23 Thread Glenn Linderman
So, I'm locked into a Bluehost contract for a couple years. Was using Perl when I signed up. Only took a few hours to get my site moved from my previous host, also cPanel based... a few tweaks and it was running. They seem to be OK, but their help forums are pretty sparse... no references

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-23 Thread alex23
On Nov 24, 9:59 am, bMotu [EMAIL PROTECTED] wrote: AttributeError: 'module' object has no attribute 'extsep' why is this attribute gone in 3.0rc3 ? where is this documented ? According to the 3.0 docs, it should still be there. But I'm finding the same with rc2. Looks like a bug. It's

Re: can the sequence of entries in a dictionary be depended on?

2008-11-23 Thread Carsten Haese
Diez B. Roggisch wrote: AFAIK the order is deterministic as long as you don't alter the dict between iterations. However, this is an implementation detail. It's not an implementation detail. It's documented behavior. Thus quoth http://docs.python.org/library/stdtypes.html#mapping-types-dict :

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-23 Thread Terry Reedy
alex23 wrote: On Nov 24, 9:59 am, bMotu [EMAIL PROTECTED] wrote: AttributeError: 'module' object has no attribute 'extsep' why is this attribute gone in 3.0rc3 ? where is this documented ? According to the 3.0 docs, it should still be there. But I'm finding the same with rc2. Looks like a

Re: Quick nested loop syntax?

2008-11-23 Thread Tim Chase
if I remember correctly, wasn't there a way to quickly iterate through nested loops? Something like a = { a, b, c } b = { 4, 9, 13} for (x, y) in someoperator(a, b): print(x, y) You may be reaching for this thread: http://mail.python.org/pipermail/python-list/2008-January/473650.html

Re: can the sequence of entries in a dictionary be depended on?

2008-11-23 Thread John Machin
On Nov 24, 11:59 am, Carsten Haese [EMAIL PROTECTED] wrote: Diez B. Roggisch wrote: AFAIK the order is deterministic as long as you don't alter the dict between iterations. However, this is an implementation detail. It's not an implementation detail. It's documented behavior. Thus

Estimating size of dictionary

2008-11-23 Thread python
Is there a formula for determining the approximate size of a dictionary (minus its data) under 32 and 64 bit Python with a specific average key size? For instance, if we were running a 64-bit version of Python and created a dictionary of 1 million items with an average key length of 48 bytes, is

Re: how to dynamically instantiate an object inheriting from several classes?

2008-11-23 Thread Rafe
On Nov 22, 9:02 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Fri, 21 Nov 2008 15:11:20 -0700, Joe Strout wrote: I have a function that takes a reference to a class, Hmmm... how do you do that from Python code? The simplest way I can think of is to extract the name of

Best way to dynamically get an attribute from a module from within the same module

2008-11-23 Thread Rafe
What are the pros and cons of these two patterns (and are there any other)? Which is the best way to dynamically get an attribute from a module from within the same module? 1) Using the name of the module this_module = sys.modules[__name__] attr = getattr(this_module, whatever, None) 2)

Re: can the sequence of entries in a dictionary be depended on?

2008-11-23 Thread Carsten Haese
John Machin wrote: the lists will directly correspond? What does that mean? It means that e.g. zip(d.keys(), d.values()) == d.items() is guaranteed to be True. Why not the lists will be equal i.e. list1 == list2? How about Provided that keys are neither added nor deleted, the order of

Re: strange pythoncom.com_error - it only happens once

2008-11-23 Thread Rafe
On Nov 21, 5:02 pm, Rafe [EMAIL PROTECTED] wrote: On Nov 21, 4:50 pm, Rafe [EMAIL PROTECTED] wrote: Hi, I'm getting this error: #   File C:\Python25\Lib\site-packages\win32com\client\dynamic.py, line 491, in __getattr__ #     raise pythoncom.com_error, details # COM Error:

Re: Module Structure/Import Design Problem

2008-11-23 Thread Gabriel Genellina
En Fri, 21 Nov 2008 17:39:14 -0200, Stef Mientki [EMAIL PROTECTED] escribió: Gabriel Genellina wrote: En Thu, 20 Nov 2008 17:36:11 -0200, Stef Mientki [EMAIL PROTECTED] escribió: I'm not an expert, I even don't fully understand your problem, but having struggled with imports in the past,

Installing python 2.6 on Vista

2008-11-23 Thread GALLOWAY Stuart J (SVHM)
I had python 2.5 on my computer and did a double install with 2.6 out of curiosity. Python 2.5 and idle had been working. I was logged on as administrator (only user account on my computer) and installed python2.6 for all users. Python 2.6 idle did not work, and following installation nor

Re: Installing python 2.6 on Vista

2008-11-23 Thread Glenn Linderman
On approximately 11/23/2008 9:17 PM, came the following characters from the keyboard of GALLOWAY Stuart J (SVHM): I accept that this may be essentially a VISTA problem. So, upgrade to XP, until Microsoft fixes Vista! I've got 3 versions of Python running here on XP! No problems

Re: Installing python 2.6 on Vista

2008-11-23 Thread Glenn Linderman
On approximately 11/23/2008 9:17 PM, came the following characters from the keyboard of GALLOWAY Stuart J (SVHM): I would strongly recommend that an official PORTABLE python for windows should be a standard distribution so we can bypass all the windows rubbish if we want to. Sorry about

Security implications of using open() on untrusted strings.

2008-11-23 Thread r0g
Hi there, I'm trying to validate some user input which is for the most part simple regexery however I would like to check filenames and I would like this code to be multiplatform. I had hoped the os module would have a function that would tell me if a proposed filename would be valid on the host

Re: Estimating size of dictionary

2008-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2008 21:10:34 -0500, python wrote: Is there a formula for determining the approximate size of a dictionary (minus its data) under 32 and 64 bit Python with a specific average key size? If you're using Python 2.6, the sys module has a new function getsizeof() which returns the

Re: Installing python 2.6 on Vista

2008-11-23 Thread r0g
Glenn Linderman wrote: On approximately 11/23/2008 9:17 PM, came the following characters from the keyboard of GALLOWAY Stuart J (SVHM): But, hey, a portable version of Python would be nice! Would probably make the job of the various packagers that make .exe files easier, too! Erm, a

Re: Using dictionary to hold regex patterns?

2008-11-23 Thread Marc 'BlackJack' Rintsch
On Mon, 24 Nov 2008 00:46:42 +0100, Gilles Ganault wrote: On Sun, 23 Nov 2008 23:18:06 +, MRAB [EMAIL PROTECTED] wrote: A list is an ordered collection of items. Each item can be anything: a string, an integer, a dictionary, a tuple, a list... Yup, learned something new today. Naively, I

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-23 Thread Christian Heimes
bMotu wrote: IDLE 2.6 import os os.extsep '.' running XP this result is fine ... ! IDLE 3.0rc3 import os os.extsep Traceback (most recent call last): File pyshell#1, line 1, in module os.extsep AttributeError: 'module' object has no attribute 'extsep' why is this attribute gone in

Re: Security implications of using open() on untrusted strings.

2008-11-23 Thread Steven D'Aprano
On Mon, 24 Nov 2008 00:44:45 -0500, r0g wrote: Hi there, I'm trying to validate some user input which is for the most part simple regexery however I would like to check filenames and I would like this code to be multiplatform. I had hoped the os module would have a function that would

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-23 Thread Martin v. Löwis
Christian Heimes wrote: bMotu wrote: IDLE 2.6 import os os.extsep '.' running XP this result is fine ... ! IDLE 3.0rc3 import os os.extsep Traceback (most recent call last): File pyshell#1, line 1, in module os.extsep AttributeError: 'module' object has no attribute 'extsep'

Python 3000

2008-11-23 Thread Dokorek
Python 3000 (a.k.a. Py3k, and released as Python 3.0) is a new version of the language that is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of

[issue4393] Portability fixes in longobject.c

2008-11-23 Thread Mark Dickinson
New submission from Mark Dickinson [EMAIL PROTECTED]: This patch fixes 3 classes of bugs in Objects/longobject.c: (1) declarations of a variable (usually a counter into the digits of a PyLong) as int instead of Py_ssize_t. (2) missing (twodigits) casts from multiplies and shifts. (3) use of ''

[issue4389] Uninstaller Lacks an Icon

2008-11-23 Thread Retro
Retro [EMAIL PROTECTED] added the comment: So are you willing to fix this issue? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4389 ___ ___ Python-bugs-list

[issue4394] make the storage of the password optional in .pypirc (using the prompt)

2008-11-23 Thread Tarek Ziadé
New submission from Tarek Ziadé [EMAIL PROTECTED]: Right now you HAVE to store a clear text password in .pypirc. But this should not be necessary since the register command does a getpass.getpass call to get the password from the prompt and use it to authenticate to pypi. So what do we miss ?

[issue4394] make the storage of the password optional in .pypirc (using the prompt)

2008-11-23 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] added the comment: According to my tests, something is hosed with password saving in the register command for 3.0 already: the saved password doesn't seem to be used. Before this patch is considered, the other problem should be resolved (but isn't yet reported

[issue4395] Document auto __ne__ generation

2008-11-23 Thread Terry J. Reedy
New submission from Terry J. Reedy [EMAIL PROTECTED]: 3.0c3 doc (Basic customization) says There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining __eq__(), one should also define __ne__() so that the

[issue4396] parser module fails to validate with statements.

2008-11-23 Thread David Binger
New submission from David Binger [EMAIL PROTECTED]: The parser module validates node trees when they are built from sequences. The validator must, unfortunately, be updated every time there is a change in the grammar. The current validator fails to validate with statements. This bug probably

[issue4392] incorrect parameter name for collections.namedtuple

2008-11-23 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: Fixed in r67355. -- resolution: - fixed status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4392 ___

[issue4370] warning: unknown conversion type character `z' in format

2008-11-23 Thread Akira Kitada
Akira Kitada [EMAIL PROTECTED] added the comment: I looked into the code and found these warnings about 'z' were not from printf family but PyString_FromFormat. Apparently PyString_FromFormat handles the 'z' itself, without delegating that to printf family. Then why am I getting these warnings?

[issue4382] test_dbm_dumb fails due to character encoding issue on Mac OS X

2008-11-23 Thread Martina Oefelein
Martina Oefelein [EMAIL PROTECTED] added the comment: Yes, the patch fixes the issue for me. ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4382 ___ ___

[issue4391] optparse: use proper gettext plurals forms

2008-11-23 Thread Raymond Hettinger
Changes by Raymond Hettinger [EMAIL PROTECTED]: -- priority: - low ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4391 ___ ___ Python-bugs-list mailing

[issue4073] distutils build_scripts and install_data commands need 2to3 support

2008-11-23 Thread Martin v. Löwis
Martin v. Löwis [EMAIL PROTECTED] added the comment: I'd like to see this in 3.0. It will help people porting to 3.0 better. -- assignee: - barry nosy: +barry priority: - release blocker ___ Python tracker [EMAIL PROTECTED]

[issue4397] test_socket fails occassionaly in teardown: AssertionError: [Errno 57] Socket is not connected

2008-11-23 Thread Martina Oefelein
New submission from Martina Oefelein [EMAIL PROTECTED]: test_socket fails randomly in about 1 of 50 iterations (MacOS X 10.5.5 intel): $ for ((;;)); do DYLD_FRAMEWORK_PATH=/Users/martina/Downloads/Python- 3.0rc3: ./python.exe -E -bb ./Lib/test/regrtest.py -l test_socket;done test_socket 1 test

[issue4398] erewer

2008-11-23 Thread Derek Hval
Changes by Derek Hval [EMAIL PROTECTED]: -- files: aa.html nosy: der74hva3 severity: normal status: open title: erewer type: compile error Added file: http://bugs.python.org/file12112/aa.html ___ Python tracker [EMAIL PROTECTED]

[issue4399] shard appears where shared intended

2008-11-23 Thread David W. Lambert
New submission from David W. Lambert [EMAIL PROTECTED]: http://docs.python.org/dev/3.0/library/ctypes.html insert e into shard. Errors have dissimilar importance. The manual is so good that this is the worst I can find today. -- assignee: georg.brandl components: Documentation

[issue4399] shard appears where shared intended

2008-11-23 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: Fixed in r67359, thanks! -- resolution: - fixed status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4399 ___

[issue4398] erewer

2008-11-23 Thread Martin v. Löwis
Changes by Martin v. Löwis [EMAIL PROTECTED]: -- resolution: - invalid status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4398 ___

  1   2   >