PyOhio registration is open

2008-07-17 Thread Catherine Devlin
Registration is open for PyOhio, the daylong regional miniconference on July 26 in Columbus, OH. http://www.pyohio.org/reg/register/ Registration is free, but registering early guarantees your spot and helps the organizers schedule talks to avoid conflicts. See you on July 26 in Columbus, OH!

Berlin User Group Meeting 25.07.

2008-07-17 Thread Stephan Diehl
The Berlin User Group is meeting on Fr., the 25th of July at 7pm. Address: Prater beergarden - Kastanienallee 7-9 - 10435 Berlin - Germany In case of bad weather, there is a restaurant at the same location. See you there! Stephan http://wiki.python.de/User_Group_Berlin --

RELEASED Python 2.6b2 and 3.0b2

2008-07-17 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the second beta releases of Python 2.6 and Python 3.0. Please note that these are beta releases, and as such are not suitable for production

Re: Is there any component-oriented (non-MVC) web framework available for Python?

2008-07-17 Thread Diez B. Roggisch
Alis schrieb: Hi Is there any component-oriented (non-MVC) web framework available for Python? That is something like Apache Wicket, Tapestry or JSF, but I need it to be in Python. ToscaWidgets, can be used with any WSGI-compliant framework. Diez --

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread tcfg
dear Diez: I need step into c function in extending module(DLL) when debugging the script. and I want Single-step debugging the extend module itself, but python script Launched The whole process. best regards fang -- http://mail.python.org/mailman/listinfo/python-list

Re: singletons

2008-07-17 Thread Carl Banks
On Jul 16, 6:20 pm, Craig Allen [EMAIL PROTECTED] wrote: Anyone have any comments?  Is there anything wrong, evil, or ugly about using a module this way, or am I correct to think that actually, this is a common approach in python. Is it pythonic? The one drawback to this is that it could

Rotating a cube

2008-07-17 Thread J-Burns
Hello. Need some help here. I have a 4*4 cube. So the equation of the cube becoming: x + 4*y + 16*z Now i want to rotate this cube 90 degrees anticlockwise( a right rotation). How can i do that? The rotation must take place with the axis of rotation

Instance

2008-07-17 Thread karthikbalaguru
Hi, I am new to python. I am trying to use the python files given to me for bringing up a setup. I get the following error while trying to use a python file - AttributeError : Classroom instance has no attribute 'desk_offset' How to resolve this ? Should i need to define desk_offset to zero in

Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Hello Lets say I have a string: --a href=/browse/brick--brick--/a-- The -- needs to be replaced with or where applicable. and I want the brick out of that string (the second brick that is). How can I get just the brick out of that string? -- View this message in context:

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Alexandr N Zamaraev wrote: s = '--a href=/browse/brick--brick--/a--' s '--a href=/browse/brick--brick--/a--' ''.join('%s' % l if i % 2 == 1 else l for i, l in enumerate(s.split('--'))) ' /browse/brick brick ' -- http://mail.python.org/mailman/listinfo/python-list I'm sorry, I

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexandr N Zamaraev
Alexnb wrote: s = '--a href=/browse/brick--brick--/a--' s '--a href=/browse/brick--brick--/a--' ''.join('%s' % l if i % 2 == 1 else l for i, l in enumerate(s.split('--'))) ' /browse/brick brick ' I'm sorry, I don't think I was being clear. I replaced the 's with -- so it would post online

Re: Instance

2008-07-17 Thread Jeroen Ruigrok van der Werven
-On [20080717 09:01], karthikbalaguru ([EMAIL PROTECTED]) wrote: AttributeError : Classroom instance has no attribute 'desk_offset' You are using a Classroom instance and probably assigning something to the instance's variable/attribute 'desk_offset'. Except that the class Classroom has

Handling events using pycairo

2008-07-17 Thread Mr SZ
Hi, I'm trying to create a rectangle when the user presses or releases the mouse over a cairo object.I'm using the eventBox to capture the mouse events. Now the problem is the shapes is beng drawn when I call it from the expose_event event handler and nothing happens when I call the same from

how to do -vv for very verbose?

2008-07-17 Thread Thomaye
Create something else. There is no such thing as very verbose!!! There is only verbose or not verbose. **Get the scoop on last night's hottest shows and the live music scene in your area - Check out TourTracker.com! (http://www.tourtracker.com?NCID=aolmus0005000112) --

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
Alexandr N Zamaraev wrote: Alexnb wrote: s = '--a href=/browse/brick--brick--/a--' s '--a href=/browse/brick--brick--/a--' ''.join('%s' % l if i % 2 == 1 else l for i, l in enumerate(s.split('--'))) ' /browse/brick brick ' I'm sorry, I don't think I was being clear. I replaced the

Re: Rotating a cube

2008-07-17 Thread Fredrik Lundh
J-Burns wrote: Is there a built in Python function for this? for answering questions that have nothing to do with programming, and looks quite a bit like homework? don't think they've added that one yet. maybe you should look for a geometry newsgroup/forum? /F --

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: dear Diez: I need step into c function in extending module(DLL) when debugging the script. and I want Single-step debugging the extend module itself, but python script Launched The whole process. That is exactly what attaching a C-debugger to python will give

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread Fredrik Lundh
Stefan Scholl wrote: Django isn't ready. That's a remarkably ignorant statement. The 1.0 release will be in September. So? 1.0 will be done then, yes. In what way does that mean that Django itself isn't ready, in any sane sense of that word? (For bystanders, Django's 0.91 release in

How to process a very large (4Gb) tarfile from python?

2008-07-17 Thread Terry Carroll
I am trying to do something with a very large tarfile from within Python, and am running into memory constraints. The tarfile in question is a 4-gigabyte datafile from freedb.org, http://ftp.freedb.org/pub/freedb/ , and has about 2.5 million members in it. Here's a simple toy program that just

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread Stefan Scholl
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Thu, 17 Jul 2008 05:41:11 +0200, Stefan Scholl wrote: Fredrik Lundh [EMAIL PROTECTED] wrote: Stefan Scholl wrote: Django isn't ready. That's a remarkably ignorant statement. The 1.0 release will be in September. So what? It's not

Good HTML Parser

2008-07-17 Thread Chris
Can anyone recommend a good HTML/XHTML parser, similar to HTMLParser.HTMLParser or htmllib.HTMLParser, but able to intelligently know that certain tags, like br, are implicitly closed? I need to iterate through the entire DOM, building up a DOM path, but the stdlib parsers aren't calling

Re: Rotating a cube

2008-07-17 Thread J-Burns
On Jul 17, 12:53 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: J-Burns wrote: Is there a built in Python function for this? for answering questions that have nothing to do with programming, and looks quite a bit like homework? don't think they've added that one yet. maybe you should look for

Remove some characters from a string

2008-07-17 Thread Julien
Hi, I can't seem to find the right regular expression to achieve what I want. I'd like to remove all characters from a string that are not numbers, letters or underscores. For example: magic_function('[EMAIL PROTECTED]') str: 'si_98udasgf' Would you have any hint? Thanks a lot! Julien --

Re: Need help getting BeautifulSoup contents

2008-07-17 Thread dusans
I dont quite understand what u want. U should paste the html here http://pastebin.com/ also provide the result that u want. If u dont take the time to write what u wont, nobody will take the time to help u On Jul 17, 7:38 am, Alexnb [EMAIL PROTECTED] wrote: The trick to this one is that the

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread bearophileHUGS
On Jul 17, 9:50 am, Alexnb: how can I test to see if the first char of a string is ? I suggest you to try the interactive shell: hello[0] 'h' hello[0] == False hello[0] == h True hello.startswith(h) True Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: About wmi

2008-07-17 Thread Tim Golden
patrol wrote: I will try to modify the wmi.py ,however I'm a novice.It will take a long time. You can give it up temporarily. If you don't mind ,can you tell me where needs modifying and how? Just unicode? Or Other? OK. Thanks for your patience on this one, Patrol. What I propose to do is to

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Alexnb
bearophileHUGS wrote: On Jul 17, 9:50 am, Alexnb: how can I test to see if the first char of a string is ? I suggest you to try the interactive shell: hello[0] 'h' hello[0] == False hello[0] == h True hello.startswith(h) True Bye, bearophile --

common elements between list of lists and lists

2008-07-17 Thread antar2
Hello, I am a beginner in python. following program prints the second element in list of lists 4 for the first elements in list 4 that are common with the elements in list 5 list4 = [['1', 'a'],['4', 'd'],['8', 'g']] list5 = ['1', '2', '3'] for j in list4: for k in list5:

Re: common elements between list of lists and lists

2008-07-17 Thread Alexandr N Zamaraev
list4 = [['1', 'a'],['4', 'd'],['8', 'g']] list5 = [1, 2, 3] set5 = set(list5) [x for n, x in list4 if int(n) in set5] ['a'] -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove some characters from a string

2008-07-17 Thread Chris
On Jul 17, 10:13 am, Julien [EMAIL PROTECTED] wrote: Hi, I can't seem to find the right regular expression to achieve what I want. I'd like to remove all characters from a string that are not numbers, letters or underscores. For example: magic_function('[EMAIL PROTECTED]') str:

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread Fredrik Lundh
Stefan Scholl wrote: And by the way: The quote was changed by deleting something on the same line: June 2008 is a bit too early. Django isn't ready. vs. Django isn't ready. Is this a language issue? That you meant to write django 1.0 isn't done (as in

Re: Remove some characters from a string

2008-07-17 Thread Paul Hankin
On Jul 17, 9:13 am, Julien [EMAIL PROTECTED] wrote: Hi, I can't seem to find the right regular expression to achieve what I want. I'd like to remove all characters from a string that are not numbers, letters or underscores. For example: magic_function('[EMAIL PROTECTED]') str:

Re: Remove some characters from a string

2008-07-17 Thread Fredrik Lundh
Julien wrote: I can't seem to find the right regular expression to achieve what I want. I'd like to remove all characters from a string that are not numbers, letters or underscores. For example: magic_function('[EMAIL PROTECTED]') str: 'si_98udasgf' the easiest way is to replace the

Re: common elements between list of lists and lists

2008-07-17 Thread Bighead
On Jul 17, 4:30 pm, antar2 [EMAIL PROTECTED] wrote: Hello, I am a beginner in python. following program prints the second element in list of lists 4 for the first elements in list 4 that are common with the elements in list 5 list4 = [['1', 'a'],['4', 'd'],['8', 'g']] list5 = ['1', '2',

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Fredrik Lundh
Alexnb wrote: hello[0] 'h' hello[0] == False hello[0] == h True hello.startswith(h) True really? That's just like C. I thought that it would fail because of the way lists work. Thanks! what way? the first three will fail if the string is empty. [0] Traceback (most recent

Question about properties

2008-07-17 Thread Frank Millman
Hi all I have started experimenting with properties. The example in the 2.5 docs uses an inconsistent mixture of single and double underscores for the internal representation of the attribute. I was going to file a documentation bug, but then I checked the 2.6 docs online, and I see it has been

Re: Question about properties

2008-07-17 Thread Fredrik Lundh
Frank Millman wrote: I thought that the main point of using property was to prevent direct access to the attribute. Not prevent access to as much as add behaviour to. Is this a valid comment, or does it come under the category of 'we are all adults here'? The latter. And the __ doesn't

Fwd: Hello

2008-07-17 Thread spandana g
Hello , Traceback (most recent call last): File C:\Python25\hadi_yahoo.py, line 12, in module file_source.write(urllib2.urlopen(req).read()) File C:\Python25\lib\urllib2.py, line 124, in urlopen return _opener.open(url, data) File C:\Python25\lib\urllib2.py, line 387, in open

Python Pmw ScrollListBox selectioncommand dblclickcommand

2008-07-17 Thread Guilhem Faure
Hello everybody, I try to use Pmw library - ScrollListBox. If I take the example of the reference web site (see below, I just quote the minimal code to launch, I note by - the line which are not execute when I click) It works, except selectioncommand and dblclickcommand: associate function

Re: Python embedding question.

2008-07-17 Thread Thomas Troeger
Jan Claeys wrote: I'd say that PyGame could be a solution. Or otherwise you could do your own audio/graphics programming (you don't tell us which OS you use, but there exist python modules that allow you to do barebones graphics sound programming on linux...). Yes, I'm using a very small

Re: Fwd: Hello

2008-07-17 Thread Fredrik Lundh
spandana g wrote: HTTPError: HTTP Error 999: Unable to process request at this time -- error 999 Previously i got the error which I have attached below when I use just urlopen . But now when I use this http request user_agent='Mozilla/3.0(compatible;MISE 5.5;Windows NT)'

Re: singletons

2008-07-17 Thread Craig Allen
On Jul 16, 7:01 pm, Lawrence D'Oliveiro [EMAIL PROTECTED] central.gen.new_zealand wrote: In message [EMAIL PROTECTED], Craig Allen wrote: ... the ideal is still that tl = TehLibrary() would always return the same object. class TehLibrary(object) : ... @classmethod ... def

Re: Fwd: Hello

2008-07-17 Thread Fredrik Lundh
they have an official API, you know: http://developer.yahoo.com/search/boss/ and yes, there are other options too, including pYsearch which is available from their developer network: http://developer.yahoo.com/python/python-pysearch.html for more Python stuff from/for Yahoo, see

Babelfish translation ...

2008-07-17 Thread Stef Mientki
hello, I've build a translation tool, to translate all strings in a python source file. As a extra gadget I added translation through Babel Fish, using beautifulsoup. Although it works functionally, it can take lots of time waiting for the translation. What I basically do is, after selecting

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread alex23
On Jul 17, 6:04 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Django's 0.91 release in early 1996 While I totally agree with position, I'm pretty sure you mean 2006 here :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Good HTML Parser

2008-07-17 Thread Diez B. Roggisch
Chris wrote: Can anyone recommend a good HTML/XHTML parser, similar to HTMLParser.HTMLParser or htmllib.HTMLParser, but able to intelligently know that certain tags, like br, are implicitly closed? I need to iterate through the entire DOM, building up a DOM path, but the stdlib parsers

storing references instead of copies in a dictionary

2008-07-17 Thread mk
Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose): def f2(arg): ... return f2 + arg ... def f1(arg): ... return f1 + arg ... a={'1': f1, '2': f2} [ x[1](x[0]) for x in

Re: Problem with MySQLdb and mod_python

2008-07-17 Thread Cyril Bazin
Thanks for your reply The apache log contains lines like : [Tue Jul 15 23:31:01 2008] [notice] mod_python (pid=11836, interpreter='www.toto.fr'): Importing module '/usr/local/apache2/htdocs/intranet/courrier/test.py' [Tue Jul 15 23:31:02 2008] [notice] child pid 11836 exit signal Segmentation

Re: Testing for connection to a website

2008-07-17 Thread Venky Shankar
ping the universal DNS ? (4.2.2.2) -Venky On Wed, Jul 16, 2008 at 1:17 AM, Jordan [EMAIL PROTECTED] wrote: On Jul 15, 3:43 pm, Alexnb [EMAIL PROTECTED] wrote: Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to

Re: Testing for Internet Connection

2008-07-17 Thread Venky Shankar
may be try to open a connection to 4.2.2.2 at port 53 ? -vks On Wed, Jul 16, 2008 at 12:13 AM, norseman [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2008-07-15, Alexnb [EMAIL PROTECTED] wrote: What exactly do you think will work? I am not sure what you think I should do? If I use

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread [EMAIL PROTECTED]
On 16 juil, 10:35, Stefan Scholl [EMAIL PROTECTED] wrote: Dave U. Random [EMAIL PROTECTED] wrote: http://snipr.com/PracticalDjango June 2008 is a bit too early. Django isn't ready. Oh, really ? Too bad. But, wait... If Django isn't ready, what's that framework I've been using for almost

Re: storing references instead of copies in a dictionary

2008-07-17 Thread Uwe Schmitt
On 17 Jul., 13:45, mk [EMAIL PROTECTED] wrote: Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose):   def f2(arg): ...     return f2 + arg ...     def f1(arg): ...     return f1 +

Re: How can i use a variable without define it ?

2008-07-17 Thread [EMAIL PROTECTED]
On 16 juil, 11:06, zhw [EMAIL PROTECTED] wrote: On 7月16日, 下午4时47分, Ben Finney [EMAIL PROTECTED] wrote: zhw [EMAIL PROTECTED] writes: How can i use a variable without define it ? What do you mean by use? That's so vague I can think of many possible interpretations. What do you

Re: singletons

2008-07-17 Thread Uwe Schmitt
On 17 Jul., 00:20, Craig Allen [EMAIL PROTECTED] wrote: I have several classes in our system which need to act like singletons, they are libraries of data classifications, and other such libraries of configurations for the system which need to be global. ... Is it pythonic? My approach in

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread fang
Dear Diez: It is attaching a C-debugger to python. I can attach python- debugger(for example:wingIDE) to c-debugger(for example:VS2008), but I cannot attach VS2008 to wingIDE. I need both python statement and c statement can be single-step debugged. best regards fang --

Re: bad recursion, still works

2008-07-17 Thread Jeff
Thanks, that made things very clear. I like that technique for adding memoization via the parameter. That is clever. It would be nice if there were a way to have multiple functions close over a shared local variable in Python, like let-binding in lisp. --

Re: storing references instead of copies in a dictionary

2008-07-17 Thread John Machin
On Jul 17, 9:45 pm, mk [EMAIL PROTECTED] wrote: Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose): def f2(arg): ... return f2 + arg ... def f1(arg): ... return f1 +

Re: storing references instead of copies in a dictionary

2008-07-17 Thread Calvin Spealman
On Thu, Jul 17, 2008 at 7:45 AM, mk [EMAIL PROTECTED] wrote: Hello everyone, I'm storing functions in a dictionary (this is basically for cooking up my own fancy schmancy callback scheme, mainly for learning purpose): def f2(arg): ... return f2 + arg ... def f1(arg): ... return

Re: Instance

2008-07-17 Thread Calvin Spealman
On Thu, Jul 17, 2008 at 2:56 AM, karthikbalaguru [EMAIL PROTECTED] wrote: Hi, I am new to python. I am trying to use the python files given to me for bringing up a setup. I get the following error while trying to use a python file - AttributeError : Classroom instance has no attribute

Re: Amazon: Practical Django Projects by James Bennett (June 2008)

2008-07-17 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] writes: On 16 juil, 10:35, Stefan Scholl [EMAIL PROTECTED] wrote: Dave U. Random [EMAIL PROTECTED] wrote: http://snipr.com/PracticalDjango June 2008 is a bit too early. Django isn't ready. Oh, really ? Too bad. But, wait... If Django isn't ready, what's

Re: Getting a unknown word out of a list with no spaces

2008-07-17 Thread Calvin Spealman
BeautifulSoup. You need a good html parsing, not some one-shot code to handle one tiny unflexable pattern. On Thu, Jul 17, 2008 at 3:07 AM, Alexnb [EMAIL PROTECTED] wrote: Hello Lets say I have a string: --a href=/browse/brick--brick--/a-- The -- needs to be replaced with or where

Re: Pickle and wx.TextCtrl

2008-07-17 Thread DWebre
D. J. Webre, Jr. PE PLS Gabriel Genellina [EMAIL PROTECTED]

Re: Javascript - Python RSA encryption interoperability

2008-07-17 Thread Evren Esat Ozkan
Hi, Thank you very much. Your code is worked like a charm and saved my honeymoon :) Thanks again, Evren On Jul 4, 6:19 pm, [EMAIL PROTECTED] wrote: Evren Esat Ozkan napisa³(a): Hello, I'm trying to encrypt a string with RSA. But it needs to be compitable with Dave's JavaScript RSA

Re: How to process a very large (4Gb) tarfile from python?

2008-07-17 Thread Uwe Schmitt
On 17 Jul., 10:01, Terry Carroll [EMAIL PROTECTED] wrote: I am trying to do something with a very large tarfile from within Python, and am running into memory constraints.  The tarfile in question is a 4-gigabyte datafile from freedb.org,http://ftp.freedb.org/pub/freedb/, and has about 2.5

Re: storing references instead of copies in a dictionary

2008-07-17 Thread mk
Calvin Spealman wrote: To your actual problem... Why do you wanna do this anyway? If you want to change the function in the dictionary, why don't you simply define the functions you'll want to use, and change the one you have bound to the key in the dictionary when you want to change it? In

Re: Python embedding question (2).

2008-07-17 Thread Thomas Troeger
I'd say that PyGame could be a solution. Or otherwise you could do your own audio/graphics programming (you don't tell us which OS you use, but there exist python modules that allow you to do barebones graphics sound programming on linux...). After some more reading I've stumbled over

Re: Babelfish translation ...

2008-07-17 Thread Stefan Behnel
Stef Mientki stef.mientki at gmail.com writes: Although it works functionally, it can take lots of time waiting for the translation. What I basically do is, after selecting a new string to be translated: kwds = { 'trtext' : line_to_be_translated, 'lp' :'en_nl'} soup =

% sign in python?

2008-07-17 Thread korean_dave
What does this operator do? Specifically in this context test.log( [[Log level %d: %s]] % ( level, msg ), description ) (Tried googling and searching, but the % gets interpreted as an operation and distorts the search results) -- http://mail.python.org/mailman/listinfo/python-list

Re: % sign in python?

2008-07-17 Thread Robert Bossy
korean_dave wrote: What does this operator do? Specifically in this context test.log( [[Log level %d: %s]] % ( level, msg ), description ) (Tried googling and searching, but the % gets interpreted as an operation and distorts the search results) It's the string formatting operator:

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread Diez B. Roggisch
fang wrote: Dear Diez: It is attaching a C-debugger to python. I can attach python- debugger(for example:wingIDE) to c-debugger(for example:VS2008), but I cannot attach VS2008 to wingIDE. I need both python statement and c statement can be single-step debugged. AFAIK that's not possible.

Re: % sign in python?

2008-07-17 Thread Roy H. Han
The percent sign is a placeholder. For example, if level = 1 msg = 'look' Then '[[Log level %d: %s]]' % ( level, msg ) becomes '[[Log level 1: look]]' %d means insert an integer %s means insert a string You can also use dictionaries. d = {'string1': 'hey', 'string2': 'you'} Then '%(string1)s

twistedmatrix

2008-07-17 Thread Białystok
Hi. I'm newbie in Twisted. Can anyone explain how does twisted server work? What happens after reactor.listenTCP running? I've got many connections from one client (one connection-one socket), each of them is served by class serve(Protocol). every protocol owns transport every transport owns

Re: storing references instead of copies in a dictionary

2008-07-17 Thread bgeddy
mk wrote: Calvin Spealman wrote: To your actual problem... Why do you wanna do this anyway? If you want to change the function in the dictionary, why don't you simply define the functions you'll want to use, and change the one you have bound to the key in the dictionary when you want to change

Re: storing references instead of copies in a dictionary

2008-07-17 Thread mk
Uwe Schmitt wrote: Python stores references in dictionaries and does not copy ! (unless you explicitly use the copy module) ! In your case the entry in the dictionary is a reference to the same object which f1 references, that is the object at 0xb7f0ba04. If you now say f1=...: then f1

property getter with more than 1 argument?

2008-07-17 Thread mk
It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def fget(self, fun): return fundict[fun.func_name] def fset(self, newfun):

Re: Python embedding question (2).

2008-07-17 Thread Carl Banks
On Jul 17, 9:57 am, Thomas Troeger [EMAIL PROTECTED] wrote: I'd say that PyGame could be a solution. Or otherwise you could do your own audio/graphics programming (you don't tell us which OS you use, but there exist python modules that allow you to do barebones graphics sound programming

Re: how to debug python's extend module written in c/c++ on windows

2008-07-17 Thread fang
Dear Diez: I see. I appreciate your help really. best regards fang -- http://mail.python.org/mailman/listinfo/python-list

Re: Good HTML Parser

2008-07-17 Thread Stefan Behnel
Chris wrote: Can anyone recommend a good HTML/XHTML parser, similar to HTMLParser.HTMLParser or htmllib.HTMLParser, but able to intelligently know that certain tags, like br, are implicitly closed? I need to iterate through the entire DOM, building up a DOM path, but the stdlib parsers aren't

Re: storing references instead of copies in a dictionary

2008-07-17 Thread mk
def f2(arg): return f2 +arg def f1(arg): return f1 +arg a={1:f1,2:f2} print [eval(x[1])(x[0]) for x in a.items()] def f2(arg): return New f2 +arg print [eval(x[1])(x[0]) for x in a.items()] Neat trick, if probably dangerous in some circumstances. Anyway, thanks, I didn't think

Re: Javascript - Python RSA encryption interoperability

2008-07-17 Thread Paul Rubin
Evren Esat Ozkan [EMAIL PROTECTED] writes: I'm trying to encrypt a string with RSA. But it needs to be compitable with Dave's JavaScript RSA implementation*. What exactly are you trying to do? That Javascript implementation looks like bad news. If you're trying to secure a web page, use SSL,

Unusual Exception Behaviour

2008-07-17 Thread Robert Rawlins
Hello Chaps, I have an unusual situation with my application which I've also seen once or twice in the past but never found a solution too. Basically the application stops properly reporting Exceptions when they are thrown. My application logs extensively to a file using the python logging

Re: Unusual Exception Behaviour

2008-07-17 Thread mk
I have looked through the application for any unusual or bare try/except blocks that don’t actually do anything with the except just in case any of them are causing the issue but can’t seem to see any. Why not capture exceptions themselves to a log file?

Re: How to process a very large (4Gb) tarfile from python?

2008-07-17 Thread Terry Carroll
On Thu, 17 Jul 2008 06:14:45 -0700 (PDT), Uwe Schmitt [EMAIL PROTECTED] wrote: I had a look at tarfile.py in my current Python 2.5 installations lib path. The iterator caches TarInfo objects in a list tf.members . If you only want to iterate and you are not interested in more functionallity, you

RE: Unusual Exception Behaviour

2008-07-17 Thread Robert Rawlins
Hi Mk, Why not capture exceptions themselves to a log file? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/466332 Thanks for the reply mate, I appreciate you getting back to me so quickly. I certainly like that implementation for logging the exceptions, however, at the moment I

unpacking with default values

2008-07-17 Thread McA
Hi all, probably a dumb question, but I didn't find something elegant for my problem so far. In perl you can unpack the element of a list to variables similar as in python (a, b, c = [0, 1, 2]), but the number of variables need not to fit the number of list elements. That means, if you have less

Python Behind a Squid Corporate Proxy on Windows

2008-07-17 Thread Larry Hale
Greetings, Pythonistas! My employer has a Squid Proxy between my Python programs and The Internet. I've searched high-and-low, and can only find examples online of how to do basic authentication to connect TO an external Web Server, but not how to go THROUGH a (corporate) Proxy, thus my question

Re: Unusual Exception Behaviour

2008-07-17 Thread mk
Robert Rawlins wrote: I certainly like that implementation for logging the exceptions, however, at the moment I don't even know where the exceptions are occurring, or what type they are, could I still use this method to log any and all exceptions raised in the application? Sure. I'm a

properly delete item during for item in...

2008-07-17 Thread Ratko
Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not associated with name item anymore (but still is with myList[itemIndex])? In other words, is item a

Re: unpacking with default values

2008-07-17 Thread Gary Herron
McA wrote: Hi all, probably a dumb question, but I didn't find something elegant for my problem so far. In perl you can unpack the element of a list to variables similar as in python (a, b, c = [0, 1, 2]), but the number of variables need not to fit the number of list elements. That means, if

Re: Python Behind a Squid Corporate Proxy on Windows

2008-07-17 Thread Larry Hale
Err, the line above should be: proxy_handler = urllib2.ProxyHandler( { http: http:// myusername:[EMAIL PROTECTED]:3128 } ) (Sorry! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: properly delete item during for item in...

2008-07-17 Thread Marc 'BlackJack' Rintsch
On Thu, 17 Jul 2008 09:27:27 -0700, Ratko wrote: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not associated with name item anymore (but still is with myList[itemIndex])? In other

Re: properly delete item during for item in...

2008-07-17 Thread Gary Herron
Ratko wrote: Say you have something like this: for item in myList: del item Would this actually delete the item from the list or just decrement the reference counter because the item in myList is not associated with name item anymore (but still is with myList[itemIndex])? In other words, is

RE: Unusual Exception Behaviour

2008-07-17 Thread Robert Rawlins
Hi MK, Robert Rawlins wrote: I certainly like that implementation for logging the exceptions, however, at the moment I don't even know where the exceptions are occurring, or what type they are, could I still use this method to log any and all exceptions raised in the application?

Re: properly delete item during for item in...

2008-07-17 Thread mk
Gary Herron wrote: You could remove the object from the list with del myList[i] if you knew i. HOWEVER, don't do that while looping through the list! Changing a list's length will interact badly with the for loop's indexing through the list, causing the loop to mis the element following

Re: properly delete item during for item in...

2008-07-17 Thread Ratko
On Jul 17, 9:57 am, mk [EMAIL PROTECTED] wrote: Gary Herron wrote: You could remove the object from the list with del myList[i] if you knew i. HOWEVER, don't do that while looping through the list! Changing a list's length will interact badly with the for loop's indexing through the

Re: Unusual Exception Behaviour

2008-07-17 Thread mk
http://linux.byexamples.com/archives/365/python-convey-the-exception-traceba ck-into-log-file/ if __name__==__main__: try: main() except: print Trigger Exception, traceback info forward to log file. traceback.print_exc(file=open(errlog.txt,a))

RE: Unusual Exception Behaviour

2008-07-17 Thread Robert Rawlins
That's seriously weird. What's your Python version and platform? On my Windows and Linux machines, with more recent Python versions the above trick works flawlessly. Check your environment, namely PYTHON* variables. There may be something causing this behaviour. Unset them. Check the

Re: properly delete item during for item in...

2008-07-17 Thread Duncan Booth
mk [EMAIL PROTECTED] wrote: Iterating over a copy may _probably_ work: t=['a', 'c', 'b', 'd'] for el in t[:]: del t[t.index(el)] t [] However, is it really safe? Defining safe as works reliably in every corner case for every indexable data type? No, because you

Re: unpacking with default values

2008-07-17 Thread McA
On 17 Jul., 18:33, Gary Herron [EMAIL PROTECTED] wrote: In Python 2.x, you can't do that directly, but you should be able to create a function that lengthens or shortens an input tuple of arguments to the correct length so you can do: a,c,b = fix(1,2) d,e,f = fix(1,2,3,4) However, the

Re: property getter with more than 1 argument?

2008-07-17 Thread Roy H. Han
I don't understand what you're trying to do here. On Thu, Jul 17, 2008 at 10:57 AM, mk [EMAIL PROTECTED] wrote: It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def

  1   2   3   >