Re: About the 79 character line recommendation

2006-12-06 Thread Laurent Pointal
Olivier Langlois a écrit : > Hi, > > There was a coding standard where I worked and the intention behind this > requirement was to make the code printer friendly. Printing code source > with lines longer than 80 chars greatly hinder readability on paper. Try using size 10 font in place of size 12

Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage
des exemples de plugins pour IE oui mais qui ne sont pas embarqué dans une page Web je souhaiterai créer qqchose qui ressemble vraiment à Java VM ou Flash J'ai trouvé un début de réponse pour Firefox en télécharger le GeckoSDK mais je n'arrive pas à compiler les exemples pour le moment... merci

Re: Python Plugin for Web Browser

2006-12-06 Thread Andre Meyer
Hi I was looking for something similar in the past and could not find it. It would be very useful to have Python applets in web pages. What would you use them for? kind regards André On 5 Dec 2006 23:59:29 -0800, Sébastien Ramage <[EMAIL PROTECTED]> wrote: des exemples de plugins pour IE ou

How to use MySQL without MySQLdb module

2006-12-06 Thread Jia Lu
Hi all. I am using a hosting space with python cgi. But this host haven't got MySQLdb installed. Is there any methods to connect to Mysql without MySQLdb. Or any other DB methods with original python release? Thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Andre Meyer
Hi Sebastien Yes, I am a developer, but not C/C++. I have done Java (and many other languages) in the past, but use Python nowadays. So, I am no help for developing the plugin, sorry. I would want to use it though for developing richer Web sites in Python, rather than in JavaScript/Ajax. Having

Re: Cross-platform issue with wxRadioBox

2006-12-06 Thread cmcp
[EMAIL PROTECTED] wrote: > I have updated my script to use wx.RadioButton instead, which works > perfectly on my mac again, but now the submit button doesn't show up on > the pc and I can't click in the netid field on the pc either. any > ideas? > I modified the __init__() method of class regFram

Novice: replacing strings with unicode variables in a list

2006-12-06 Thread aine_canby
Hi, Im totally new to Python so please bare with me. Data is entered into my program using the folling code - str = raw_input(command) words = str.split() for word in words: word = unicode(word,'latin-1') word.encode('utf8') This gives an error: File "C:\Python25\lib\encodings\cp850.py"

Re: How to use MySQL without MySQLdb module

2006-12-06 Thread Alan Franzoni
Jia Lu si è divertito a scrivere: > Hi all. > I am using a hosting space with python cgi. > But this host haven't got MySQLdb installed. Are you sure there's no other mysql db interface installed? If the DB is on the very same server, it should be. If it isn't, and you'd like to access an exte

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, > > Im totally new to Python so please bare with me. > > Data is entered into my program using the folling code - > > str = raw_input(command) > words = str.split() > > for word in words: > word = unicode(word,'latin-1') > word.encode('utf8') > > This gives

Re: Does this always go right

2006-12-06 Thread Carl . Wolff
Hello Gabriel, > For your simple test dictionary, copy and deepcopy behaves > identically. If you wish, you should test using values that are > containers themselves. thanks, your answer clarifies a lot. Gtx carl -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy vs Deepcopy in multithreaded contexts

2006-12-06 Thread Carl . Wolff
Hello, this issue is solved, no help needed. Gtx Carl. - Forwarded by Carl Wolff/IT/NL/Imtech on 06-12-2006 10:51 - Carl Wolff/IT/NL/Imtech wrote on 05-12-2006 22:55:20: > Hello > > question about copy vs deepcopy used in multithreaded context: > > suppose the following program below

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread Fredrik Lundh
Diez B. Roggisch wrote: > Please provide the full script, and the desired input - then we might be > able to help you. the full *traceback* would pretty useful, too: http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-program-what-should-i-do.htm my guess is that the OP left out

Re: What are python closures realy like?

2006-12-06 Thread Fredrik Lundh
"Paddy" wrote: > I played around a bit. The following is a 'borg' version in that there > is only one counter shared between all calls of the outer function: > def fun_borg_var(initial_val=0): > ...def borg_var_inc(x=1): > ...fun_borg_var._n += x a drawback with the function att

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Im totally new to Python so please bare with me. That's no problem, really. I don't use a spellchecker, either, and it wouldn't have protected you from that particular typo... > Data is entered into my program using the folling code - > > str = raw_input(command) > w

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread Peter Otten
Peter Otten wrote: > words = s.split(): Oops, remove bogus colon here. -- http://mail.python.org/mailman/listinfo/python-list

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread John Machin
[EMAIL PROTECTED] wrote: > Hi, > > Im totally new to Python so please bare with me. > > Data is entered into my program using the folling code - > > str = raw_input(command) > words = str.split() > > for word in words: > word = unicode(word,'latin-1') > word.encode('utf8') The above statement

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread aine_canby
Fredrik Lundh skrev: > Diez B. Roggisch wrote: > > > Please provide the full script, and the desired input - then we might be > > able to help you. > > the full *traceback* would pretty useful, too: > > http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-program-what-should-i-do.h

Re: Novice: replacing strings with unicode variables in a list

2006-12-06 Thread aine_canby
[EMAIL PROTECTED] skrev: > Fredrik Lundh skrev: > > > Diez B. Roggisch wrote: > > > > > Please provide the full script, and the desired input - then we might be > > > able to help you. > > > > the full *traceback* would pretty useful, too: > > > > http://effbot.org/pyfaq/tutor-i-need-help-im-gett

Re: how to invoke the shell command and then get the result in python

2006-12-06 Thread Nick Craig-Wood
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Assuming the script isn't setuid, this would do no more damage than the > > user could do directly on the command line. > > except that when the user is typing things into the command line, he > *knows* that he's typing

PyMedia - some questions

2006-12-06 Thread Lad
Hi, Can anyone answer the following questions? Question 1. Can pyMedia create/convert FLV format? I explain in details. As I would like to publish videos for viewing in a browser , I need a good video format. I learned that FLV (Flash(tm) Video) format could be a good choice. Or does anybody sugg

Re: py2exe / Tkinter problem

2006-12-06 Thread Kleine Aap
[EMAIL PROTECTED] wrote: > I've got a python GUI working with Tkinter, and I need to package it as > an executable file, preferably a single file. Why not use an installer to bundle the python interpreter (with TKinter) and your code in a single executable file? If you don't want to distribute s

No latin9 in Python?

2006-12-06 Thread Christoph Zwerschke
I noticed that Python does not understand the codec alias names latin7 = iso8859-13, latin9 = iso8859-15 (see http://docs.python.org/lib/standard-encodings.html). Particularly latin9 is pretty popular here in Western Europe since it contains the Euro symbol (contrary to latin1). According to the

Re: About alternatives to Matlab

2006-12-06 Thread Konrad Hinsen
On Dec 5, 2006, at 16:35, Mark Morss wrote: > very well-written) _Practical OCaml_. However, I also understand that > OCaml supports only double-precision implementation of real numbers; > that its implementation of arrays is a little clunky compared to > Fortran 95 or Numpy (and I suspect not as

Re: What are python closures realy like?

2006-12-06 Thread Paul Boddie
Karl Kofnarson wrote: > > I wanted to have a function which would, depending on > some argument, return other functions all having access to > the same variable. An OO approach would do but why not > try out closures... I know that everyone will say that Python is a "multi-paradigm" language and t

Re: What are python closures realy like?

2006-12-06 Thread Fredrik Lundh
Paul Boddie wrote: > I know that everyone will say that Python is a "multi-paradigm" > language and that one should feel free to use whatever technique seems > appropriate to solve the problem at hand, but it seems to me that > there's been an explosion in nested function usage recently, with lots

Re: What are python closures realy like?

2006-12-06 Thread Tim Chase
> def foobar(arg1, arg2, arg3): > def helper(arg): > do something with arg1 and argument > def foo(): > do something with arg1 and arg3 and > call helper > def bar(): > do something with arg1 and arg2 > def zoo(

Re: No latin9 in Python?

2006-12-06 Thread Paul Boddie
Christoph Zwerschke wrote: > I noticed that Python does not understand the codec alias names > latin7 = iso8859-13, latin9 = iso8859-15 > (see http://docs.python.org/lib/standard-encodings.html). > > Particularly latin9 is pretty popular here in Western Europe since it > contains the Euro symbol (c

Re: What are python closures realy like?

2006-12-06 Thread Paul Boddie
Fredrik Lundh wrote: > > when doing some heavy optimization, I recently found myself writing: > > def foobar(arg1, arg2, arg3): > def helper(arg): > do something with arg1 and argument > def foo(): > do something with arg1 and arg3 and > ca

reloading modules

2006-12-06 Thread aine_canby
I'm using python.exe to execute my modules. I have a music.py module which contains my classes and a main.py module which uses these classes. In python.exe, I call "import main" to execute my program. The problem is that I have to close python and reopen it everytime i change music.py or main.py. W

Book recommendations

2006-12-06 Thread west
Can someone recommend a Python book for a newbie and perhaps you have a used one for sale? Thank you. Cordially, west -- http://mail.python.org/mailman/listinfo/python-list

Re: About the 79 character line recommendation

2006-12-06 Thread Thomas Ploch
Hello, for me the 80 (or 79) char border when writing code is a fundamental rule. Being at University and having to document each project on paper, it is a must do. i.e. I get code from fellow scolars, that have 160 chars per line, and to get that on paper is disgusting, especially in C/C++. So pl

len() and PEP 3000

2006-12-06 Thread Thomas Guettler
Hi, The function len() is not mentioned in the Python 3000 PEPs. I suggest that at least lists, tupples, sets, dictionaries and strings get a len() method. I think the len function can stay, removing it would break to much code. But adding the method, would bu usefull. Yes, I know, that I can ca

dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Paul Melis
Hello, I've always been using the has_key() method to test if a dictionary contains a certain key. Recently I tried the same using 'in', e.g. d = { ... } if k in d: ... and found that it seems to perform a lot better when lots of key-tests are to be performed. I also noticed that has_key() i

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Fredrik Lundh
Paul Melis wrote: > I've always been using the has_key() method to test if a dictionary > contains a certain key. Recently I tried the same using 'in', e.g. > > d = { ... } > if k in d: >... > > and found that it seems to perform a lot better when lots of key-tests > are to be performed. I als

Windows: get owner and group of a file

2006-12-06 Thread kai rosenthal
Hello, with ls -l on windows I get -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile How can I get on windows with a standard python 2.2 (without windows extensions) the information "500" and "everyone" (owner and group)? Also I cannot use popen('ls -l'). With import stat stat_info = os.lstat(my

Re: reloading modules

2006-12-06 Thread Dustan
[EMAIL PROTECTED] wrote: > I'm using python.exe to execute my modules. I have a music.py module > which contains my classes and a main.py module which uses these > classes. In python.exe, I call "import main" to execute my program. The > problem is that I have to close python and reopen it everytim

Re: reloading modules

2006-12-06 Thread Dustan
Dustan wrote: > [EMAIL PROTECTED] wrote: > > I'm using python.exe to execute my modules. I have a music.py module > > which contains my classes and a main.py module which uses these > > classes. In python.exe, I call "import main" to execute my program. The > > problem is that I have to close pyth

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[kai rosenthal] | with ls -l on windows I get | -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile | | How can I get on windows with a standard python 2.2 (without windows | extensions) the information "500" and "everyone" (owner and group)? | Also I cannot use popen('ls -l'). Wow. Python 2.2. No

Re: Windows: get owner and group of a file

2006-12-06 Thread Fredrik Lundh
Tim Golden wrote: > Wow. Python 2.2. No extensions. Not even popen (). You don't > want much, do you? I *think* the answer is that you can't. does the "group" concept even exist on Windows ? cannot recall I've ever seen "ls -l" print anything but "everyone"... -- http://mail.python.org/mail

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Paul Melis wrote: > I've always been using the has_key() method to test if a > dictionary contains a certain key. Recently I tried the same using > 'in', e.g. > > d = { ... } > if k in d: > ... Wouldn't be "if k in d.keys()" be the exact replacement? Regards, Björn -- BOFH excuse #17:

Re: Windows: get owner and group of a file

2006-12-06 Thread Diez B. Roggisch
kai rosenthal wrote: > Hello, > > with ls -l on windows I get > -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile > > How can I get on windows with a standard python 2.2 (without windows > extensions) the information "500" and "everyone" (owner and group)? > Also I cannot use popen('ls -l'). Ar

Re: len() and PEP 3000

2006-12-06 Thread Bjoern Schliessmann
Thomas Guettler wrote: > I suggest that at least lists, tupples, sets, dictionaries and > strings get a len() method. Why? > I think the len function can stay, removing it would break to much > code. But adding the method, would bu usefull. > > Yes, I know, that I can call .__len__() but that

Re: PyMedia - some questions

2006-12-06 Thread Kjell Magne Fauske
I'm not familiar with PyMedia, but this blog entry should be of interest: [Video Blogging using Django and Flash(tm) Video (FLV)] http://blog.go4teams.com/?p=56 It describes a toolchain for publishing AVI files as FLV on the web. ffmpeg is used together with a few other tools, but Python is us

Re: reloading modules

2006-12-06 Thread Frank Millman
[EMAIL PROTECTED] wrote: > I'm using python.exe to execute my modules. I have a music.py module > which contains my classes and a main.py module which uses these > classes. In python.exe, I call "import main" to execute my program. The > problem is that I have to close python and reopen it everyti

Re: SPE (Stani's Python Editor) web site?

2006-12-06 Thread Frederik Cornillie
Bernard schreef: > yes sir should I send them to you? You would do me and other gurus a great favour if you put it on a server somewhere. F > > John DeRosa a écrit : > >> On 28 Nov 2006 13:16:41 -0800, "Bernard" <[EMAIL PROTECTED]> >> wrote: >> >>> I can send you the latest tar.gz ( SPE-0.8.3

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Fredrik Lundh
Bjoern Schliessmann wrote: > Wouldn't be "if k in d.keys()" be the exact replacement? no. that would convert an O(1) operation to an O(n) operation, which would be rather silly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Book recommendations

2006-12-06 Thread Robert Hicks
On Dec 6, 7:09 am, "west" <[EMAIL PROTECTED]> wrote: > Can someone recommend a Python book for a newbie and perhaps you have a used > one for sale? Thank you. > Beginning Python: From Novice to Professional by Magnus Lie Hetland Core Python Programming (2nd Edition) by Wesley Chun There are plent

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[Fredrik Lundh] | Tim Golden wrote: | | > Wow. Python 2.2. No extensions. Not even popen (). You don't | > want much, do you? I *think* the answer is that you can't. | | does the "group" concept even exist on Windows ? cannot recall I've | ever seen "ls -l" print anything but "everyone"... |

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Peter Otten
Bjoern Schliessmann wrote: > Paul Melis wrote: > >> I've always been using the has_key() method to test if a >> dictionary contains a certain key. Recently I tried the same using >> 'in', e.g. >> >> d = { ... } >> if k in d: >> ... > > Wouldn't be "if k in d.keys()" be the exact replacement

Re: Windows: get owner and group of a file

2006-12-06 Thread Tim Chase
>> with ls -l on windows I get >> -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile > > Are you by any chance running cygwin? That comes with ls, but > windows doesn't. Another alternative might be mounting their Windows-formatted drive from within a *nix-like OS. These permissions are usually

Re: About the 79 character line recommendation

2006-12-06 Thread [EMAIL PROTECTED]
Olivier Langlois wrote: > There was a coding standard where I worked and the intention behind this > requirement was to make the code printer friendly. Printing code source > with lines longer than 80 chars greatly hinder readability on paper. > I don't think I've ever seen Python code printed out

Re: Python Plugin for Web Browser

2006-12-06 Thread Michel Claveau
Re ! Je ne sais pas quel est ton objectif, mais il est possible de couplet Python & Javascript, de manière à générer/modifier/piloter le contenu HTML de pages Web depuis Python. Je fais ça tous les jours (avec IE) Pour cela je passe par COM. Malheureusement, à cause de la paranoïa sécuritaire

Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
I've noticed something odd in Python 2.5, namely that the 2 argument version of 'assert' is broken. Or at least it seems that way to me. Run the following code in your Python interpreter: myString = None assert( myString, 'The string is either empty or set to the None type!' ) assert( myString )

Re: Windows: get owner and group of a file

2006-12-06 Thread Duncan Booth
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Tim Golden wrote: > >> Wow. Python 2.2. No extensions. Not even popen (). You don't >> want much, do you? I *think* the answer is that you can't. > > does the "group" concept even exist on Windows ? cannot recall I've > ever seen "ls -l" print anythin

Re: Windows: get owner and group of a file

2006-12-06 Thread Duncan Booth
"kai rosenthal" <[EMAIL PROTECTED]> wrote: > Hello, > > with ls -l on windows I get > -rw-r--r-- 1 500 everyone 320 Nov 09 09:35 myfile > > How can I get on windows with a standard python 2.2 (without windows > extensions) the information "500" and "everyone" (owner and group)? > Also I cannot u

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Jean-Paul Calderone
On 6 Dec 2006 06:34:49 -0800, antred <[EMAIL PROTECTED]> wrote: >I've noticed something odd in Python 2.5, namely that the 2 argument >version of 'assert' is broken. Or at least it seems that way to me. > >Run the following code in your Python interpreter: > >myString = None > >assert( myString, 'T

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
Never mind, I'm a schmuck!! =0 It should have been assert myString, 'String empty or None!' Sorry, ignore me. =\ -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Christophe
antred a écrit : > I've noticed something odd in Python 2.5, namely that the 2 argument > version of 'assert' is broken. Or at least it seems that way to me. > > Run the following code in your Python interpreter: > > myString = None > > assert( myString, 'The string is either empty or set to th

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, antred wrote: > Run the following code in your Python interpreter: > > myString = None > > assert( myString, 'The string is either empty or set to the None type!' > ) > assert( myString ) > > > > You'll notice that the first assert doesn't do anything, whereas the > se

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Peter Otten
antred wrote: > I've noticed something odd in Python 2.5, namely that the 2 argument > version of 'assert' is broken. Or at least it seems that way to me. > > Run the following code in your Python interpreter: > > myString = None > > assert( myString, 'The string is either empty or set to the N

Re: len() and PEP 3000

2006-12-06 Thread Kay Schluehr
Bjoern Schliessmann schrieb: > Thomas Guettler wrote: > > > I suggest that at least lists, tupples, sets, dictionaries and > > strings get a len() method. > > Why? Pro: Because it makes the API more monotonous and more aligned with all other OO languages that exist now and in future. It also help

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread Laurent Pointal
antred a écrit : > I've noticed something odd in Python 2.5, namely that the 2 argument > version of 'assert' is broken. Or at least it seems that way to me. > > Run the following code in your Python interpreter: > > myString = None > > assert( myString, 'The string is either empty or set to the

Re: Am I stupid or is 'assert' broken in Python 2.5??

2006-12-06 Thread antred
Yeah, it hit me seconds after I had posted my message. =0 Why didn't I think of it during the 30 minutes I spent banging my head against the keyboard going nuts over this 'bug' ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Plugin for Web Browser

2006-12-06 Thread Sébastien Ramage
oui COM je connais et ça fonctionne bien mais ce n'est pas portable d'un navigateur à l'autre et ce n'est pas ce que je cherche à faire. Mon but serait d'avoir un plugin qui permettrait d'embarquer des applets écrient en python dans les pages html à l'image de Java ou Flash, etc Pour le moment j'e

RE: Windows: get owner and group of a file

2006-12-06 Thread Tim Golden
[Duncan Booth] | You can get the owner by doing os.popen('dir /q') and parsing | the output, but it is a string not a number (which I guess is why | stat/lstat can't return a value). Good one; I'd forgotten about that. However, I don't know if the OP's restriction against popen ("ls- l") exten

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Roberto Bonvallet
Fredrik Lundh wrote: [...] > this is why e.g. > >string[:len(prefix)] == prefix > > is often a lot faster than > >string.startswith(prefix) This is interesting. In which cases does the former form perform better? [I won't stop using str.startswith anyway :) ] Regards. -- Roberto Bonv

Re: Book recommendations

2006-12-06 Thread Ramon Diaz-Uriarte
On 6 Dec 2006 05:55:44 -0800, Robert Hicks <[EMAIL PROTECTED]> wrote: > On Dec 6, 7:09 am, "west" <[EMAIL PROTECTED]> wrote: > > Can someone recommend a Python book for a newbie and perhaps you have a used > > one for sale? Thank you. I think a lot depends on your experience with other programming

PyRun_SimpleString no sys.argv[0]

2006-12-06 Thread iwl
Hello, I'm just starting with Python - would like to embed it in my windows-programm as an script-processor. For tests I use easygui some easy-wrapper for the py-tck-stuff. PyRun_SimpleString("from easygui import *\n"); PyRun_SimpleString("import sys\n"); PyRun_SimpleString("msgbox()\n"); Tra

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Andy Dingley
Paul Melis wrote: > I've always been using the has_key() method to test if a dictionary > contains a certain key. Recently I tried the same using 'in', e.g. I've found using the set type to be the quickest way to do many of these tasks. That leads me to another problem: how to cast / convert sets

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Fredrik Lundh
Andy Dingley wrote: > I need to generate a set (lots of intersections involved), but then I > need to display it sorted > >lstBugsChanged = [ bugId for bugId in setBugsChanged ] >lstBugsChanged.sort() lstBugsChanged = sorted(setBugsChanged) -- http://mail.python.org/mailman

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Roberto Bonvallet
Andy Dingley wrote: > I need to generate a set (lots of intersections involved), but then I > need to display it sorted > >lstBugsChanged = [ bugId for bugId in setBugsChanged ] >lstBugsChanged.sort() In Python > 2.4: sorted(setBugsChanged) -- Roberto Bonvallet -- http://m

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Roberto Bonvallet
I wrote: > In Python > 2.4: lastline.replace(">", ">=") -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list

ANN: Albow - A simple widget library for Pygame

2006-12-06 Thread greg
ALBOW - A Little Bit of Widgetry for PyGame --- Version 1.0 This is a very basic, no-frills widget set for creating a GUI using PyGame. It was originally developed for my PyWeek 3 competition entry, Sneak. I am documenting and releasing it as a separate pac

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Peter Otten wrote: > No, 'k in d' is equivalent to 'd.has_key(k)', only with less > (constant) overhead for the function call. Ah, thx. Thought the "x in d" syntax might search in d.values() too. Regards, Björn -- BOFH excuse #12: dry joints on cable plug -- http://mail.python.org/mailma

Re: len() and PEP 3000

2006-12-06 Thread Bjoern Schliessmann
Kay Schluehr wrote: > Pro: Because it makes the API more monotonous and more aligned > with all other OO languages that exist now and in future. It also > helps any written and unwritten IDE providing a method by means of > autocompletion. It ends endless debates with Java/C++/C# etc. and > newbie

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Fredrik Lundh
Roberto Bonvallet wrote: >> this is why e.g. >> >>string[:len(prefix)] == prefix >> >> is often a lot faster than >> >>string.startswith(prefix) > > This is interesting. In which cases does the former form perform better? no time to doublecheck right now, but iirc, last time we benchmar

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Paul Melis
Bjoern Schliessmann wrote: > Peter Otten wrote: > >> No, 'k in d' is equivalent to 'd.has_key(k)', only with less >> (constant) overhead for the function call. > > Ah, thx. Thought the "x in d" syntax might search in d.values() too. I don't think it does Python 2.4.3 (#1, Nov 19 2006, 13:16:36

Re: Book recommendations

2006-12-06 Thread vasudevram
>Can someone recommend a Python book for a newbie and perhaps you have a used one for sale? Thank you. A Byte of Python is supposed to be good for beginners too. See http://www.byteofpython.info/ Its also a recommended book on the main Python site www.python.org >From the preface: "This book se

Best memory analyzer?

2006-12-06 Thread Hugo Ferreira
Hi! I'm using the BGL bindings, but I think I'm having a giant memory leak. Thing is, I'm not sure if it is the bound C++ variables that are not being trashed, or if the leak is inside my program. What is the best way to debug this? Thanks! Hugo Ferreira -- GPG Fingerprint: B0D7 1249 447D F5B

Re: About the 79 character line recommendation

2006-12-06 Thread Michele Simionato
Steve Bergman wrote: > > So, I was wondering what more accomplished Python programmers thought > about this. I *hate* people using more than 79 chars per line! ;) They look horrible in emacs and horrible on print. I never found the need for longer lines. The limit also acts as a deterrent against

Re: What are python closures realy like?

2006-12-06 Thread Michele Simionato
Paul Boddie wrote: > I'm not pointing the finger at you here, Karl, since you seem to be > experimenting with closures, but why are they suddenly so fashionable? > Haven't the features supporting them existed in Python for a few > versions now? Don't people want to write classes any more? > > Intri

Re: Looking for a decent HTML parser for Python...

2006-12-06 Thread Stephen Eilert
Fredrik Lundh escreveu: > > Except it appears to be buggy or, at least, not very robust. There are > > websites for which it falsely terminates early in the parsing. > > which probably means that the sites are broken. the amount of broken > HTML on the net is staggering, as is the amount of

extension programing with c

2006-12-06 Thread mahdieh saeed
Hi I want to define extention module that connect to berkeley db. I define function for connection to berkeley db with c language in one file and define other function for create extention module that can import from python. function for connection to berkeley db is like this: name=BDB.c

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Andy Dingley
Roberto Bonvallet wrote: > >lstBugsChanged = [ bugId for bugId in setBugsChanged ] > In Python > 2.4: Hmmm. Thanks. Another reason to twist the admin's arm and get them to upgrade the last 2.3.4 boxen > sorted(setBugsChanged) Out of interest, whats the Pythonic way to simply cast

Re: Looking for a decent HTML parser for Python...

2006-12-06 Thread hubritic
Agreed that the web sites are probably broken. Try running the HTML though HTMLTidy (http://tidy.sourceforge.net/). Doing that has allowed me to parse where I had problem such as yours. I have also had luck with BeautifulSoup, which also includes a tidy function in it. Just Another Victim of t

PHP calls python: process vs threads

2006-12-06 Thread johnny
What I want to do is the following: Web user uploads a word doc, and I need it to move the uploaded word doc, on to another machine and conver it to pdf. Then update the database and allow immediate pdf download. I am thinking of using ftp from machine 1 -> machine 2, then convert doc to pdf on

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Roberto Bonvallet
Andy Dingley wrote: > Out of interest, whats the Pythonic way to simply cast (sic) the set to > a list, assuming I don't need it sorted? The list comprehension? mySet = set(myList) myList = list(mySet) -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Peter Otten
Andy Dingley wrote: >> sorted(setBugsChanged) > Out of interest, whats the Pythonic way to simply cast (sic) the set to > a list, assuming I don't need it sorted? The list comprehension? list(setBugsChanged) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Paul McGuire
"Peter Otten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Andy Dingley wrote: > >>> sorted(setBugsChanged) > >> Out of interest, whats the Pythonic way to simply cast (sic) the set to >> a list, assuming I don't need it sorted? The list comprehension? > > list(setBugsChanged

Extension causes segmentation fault -- suggestions on troubleshooting?

2006-12-06 Thread R. Steve McKown
Hello, I'm writing a C extension for cygwin python to access a vendor supplied DLL that allows one to set the general purpose IO (gpio) pins of the Silicon Labs' cp2103 USB/serial chip. We communicate to the device using the vendor's virtual com port driver, but the gpio pins allow us access t

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Bjoern Schliessmann
Paul Melis wrote: > I don't think it does Thanks for trying, I was too lazy ;) Regards, Björn -- BOFH excuse #52: Smell from unhygienic janitorial staff wrecked the tape heads -- http://mail.python.org/mailman/listinfo/python-list

problem with closures

2006-12-06 Thread alain
Hi, I have a problem with closures. I am trying to implement yet another design by contract decorator which would look like the following: def contract(f): def newf(*args, **kw): import new precondition = new.function(f.func_code.co_consts[1],

how to get all the "variables" of a string formating?

2006-12-06 Thread GHUM
imagine: template=""" Hello %(name)s, how are you %(action)s""" we can use it to do things like: print template % dict (name="Guido", action="indenting") Is there an easy (i.e.: no regex) way to do get the names of all parameters? get_parameters(template) should return ["name", "action"]

Re: PyQt, designer, and directional flow

2006-12-06 Thread David Boddie
borntonetwork wrote: > I am creating a simple form using designer (qt4) on Ubuntu. I use pyuic > to create a python script from the form. I run the script and the form > shows up fine. The idiosyncrasy occurs when I try to type text into a > QTextEntry widget. The text is right-aligned, not left-al

Re: dict.has_key(x) versus 'x in dict'

2006-12-06 Thread Duncan Booth
Paul Melis <[EMAIL PROTECTED]> wrote: >> Ah, thx. Thought the "x in d" syntax might search in d.values() too. > > I don't think it does > > Python 2.4.3 (#1, Nov 19 2006, 13:16:36) > [GCC 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 > Type "help", "copyright", "credits" or "licen

Re: PythonTidy

2006-12-06 Thread Chuck Rhode
Thomas Heller wrote this on Tue, Dec 05, 2006 at 07:06:30PM +0100. My reply is below. > There is still one major issue. pythonTidy uses open(input-file, > "rb") to open the Python module to tidy up. That does not work on > Windows, at least if the file has (as it should) "\r\n" newlines. Thank

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Calvin Spealman
On 6 Dec 2006 09:41:36 -0800, GHUM <[EMAIL PROTECTED]> wrote: > imagine: > > > template=""" Hello %(name)s, how are you %(action)s""" > > > we can use it to do things like: > > print template % dict (name="Guido", action="indenting") > > > Is there an easy (i.e.: no regex) way to do get the names o

Re: how to get all the "variables" of a string formating?

2006-12-06 Thread Duncan Booth
"GHUM" <[EMAIL PROTECTED]> wrote: > Is there an easy (i.e.: no regex) way to do get the names of all > parameters? > > get_parameters(template) should return ["name", "action"] > > > Python has to do this somewhere internally. how to access this > knowledge? How about: class gpHelper:

Getting started with the Python source

2006-12-06 Thread renguy
I am interested in making some changes and additions to the Python environment (Python and IDLE). I have the source code and can build the source, but what I want to know is what are the "main" functions or source code for Python and IDLE. Specifically I would like to know what in Python and IDLE w

Re: Python Plugin for Web Browser

2006-12-06 Thread MC
Bonsoir ! > As-tu des connaissances en C++ ? avec Visual C++ ? Ben, non, je ne pratique pas ces machins. Par contre, je pense qu'il existe une autre démarche, qui consiste à générer, à la volée, en Python, des sortes d'applets java/javascript. Avantages : rien à installer ; milti-navigateurs In

  1   2   3   >