Re: Modules... paths... newbie confusion

2006-08-23 Thread MrBlueSky
Well thank you all... that's all very helpful (apart from the brief diversion into MySQL, but even that was instructive!). Your comments about "setup.py" prompted me to read the pytz README.txt a bit more carefully and there it says to run "python setup.py install". And this copies stuff into sit

Re: Python and STL efficiency

2006-08-23 Thread Ray
Mc Osten wrote: > Ray <[EMAIL PROTECTED]> wrote: > > > I'm using VC++ Express, I didn't care to tweak the optimizations, I > > merely chose the "Release" configuration for the executable. It's > > blazing fast, taking only 30+ ms each run. > > Of course it is faster. We are looping 100 times,

Re: Python and STL efficiency

2006-08-23 Thread Ray
Mc Osten wrote: > In your test, you are looping 1 times, we looped 100. > In Python tests with 1 elements, it was about 10 ms. > > Moreover, we tried various Python and C++ configurations. Most of the > tests are done with Python 2.4, not 2.5. > And I used gcc4, that is to say the late

Re: What do you want in a new web framework?

2006-08-23 Thread Hendrik van Rooyen
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote: | Alex Martelli wrote: | | > Indeed, it has been truthfully observed that Python's the only language | > with more web frameworks than keywords. | | recent research indicates that it has more web frameworks than comments | in the source code. | | Aa

Re: What do you want in a new web framework?

2006-08-23 Thread Hendrik van Rooyen
"Alex Martelli" <[EMAIL PROTECTED]> | Tim Roberts <[EMAIL PROTECTED]> wrote: |... | > themselves. However, in the case of web frameworks, I believe Marc is | > fundamentally correct: the web framework proliferation in Python is | > actually doing the language a huge disservice. | | Indeed,

Re: how do you get the name of a dictionary?

2006-08-23 Thread Hendrik van Rooyen
"jojoba" <[EMAIL PROTECTED]> Wrote: | > At the risk of stating the obvious, why don't you simply add a parameter | > for the title in the invocation of the tree editor? I.e. instead of | > invoke_tree_editor(somedict) | > do | > invoke_tree_editor(somedict, "somedict") | > HTH, | > Carsten. | | |

Re: how do you get the name of a dictionary?

2006-08-23 Thread Steven D'Aprano
On Wed, 23 Aug 2006 08:56:54 +0200, Fredrik Lundh wrote: > Steven D'Aprano wrote: > >> But an upside is that it would enable more useful error messages, at least >> sometimes. Here's some trivial pseudo-code: >> >> def foo(a): >> assert len(a) > 10, "%s is too short" % a.__name__ >> >> y =

Re: Translating Javascript programs to python.

2006-08-23 Thread supercoder
Vyz wrote: > Hi, > I have a script with hundreds of lines of javascript spread accross 7 > files. Is there any tool out there to automatically or > semi-automatically translate the code into python. > > Thanks > Vyz Not a tool, but assuming the javascript is not too complex you could interpret so

Re: how do you get the name of a dictionary?

2006-08-23 Thread Robert Kern
Steven D'Aprano wrote: > On Wed, 23 Aug 2006 08:56:54 +0200, Fredrik Lundh wrote: > >> Steven D'Aprano wrote: >> >>> But an upside is that it would enable more useful error messages, at least >>> sometimes. Here's some trivial pseudo-code: >>> >>> def foo(a): >>> assert len(a) > 10, "%s is too

Re: Python and STL efficiency

2006-08-23 Thread GHUM
Mc Osten schrieb: > Yes it is. But of course you can't sat that "Python is faster than C++". Of course not. Python is faster then assembler. Proofed @ EuroPython 2006 in CERN, near the LHC Beta, in the same room many Nobel laurates gave their presentations before. Harald -- http://mail.python.

Python bindings for picasaweb ...

2006-08-23 Thread manatlan
Just a post to announce some python bindings for picasaweb (photo's service of google). ---> PycasaWeb (GPL), http://manatlan.infogami.com/pycasaweb I think it may be usefull for linux users, because it's one of the only way to post pictures on picasaweb. And can be usefull to script batch with it

Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote: > Certainly--I was not comparing 100 against 1. Referring to the > OP's statement: "However, while the python code gave the result almost > instantly, the C++ code took several seconds to run!" 30ms sounds like > a definite improvement over several seconds!

Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
GHUM <[EMAIL PROTECTED]> wrote: > Proofed @ EuroPython > 2006 in CERN, near the LHC Beta, in the same room many Nobel laurates > gave their presentations before. Have you some link? I suppose it's kind of a joke they did or something like that... -- blog: http://www.akropolix.net/rik0/blogs |

[ANN]UliPad 3.3 is released

2006-08-23 Thread limodou
What's it? It's an Editor based on wxPython. NewEdit is the old name, and UliPad is the new name. UliPad uses Mixin and Plugin technique as its architecture. Most of its classes can be extended via mixin and plugin components, and finally become an integrity class at creating the instance

Re: Python and STL efficiency

2006-08-23 Thread Ray
Mc Osten wrote: > Of course. I suppose there's something broken in OP's C++ setup (in fact > the version I compiled with VCPP 2005 also takes a lot of seconds... > something like 20-30 seconds, but of course this makes me think I > haven't understood how it is supposed to work, since my gcc gives

Re: Python and STL efficiency

2006-08-23 Thread Maric Michaud
Le mardi 22 août 2006 23:15, Fredrik Lundh a écrit : > Maric Michaud wrote: > > The problem here, is that the strings in the set are compared by value, > > which is not optimal, and I guess python compare them by adress ("s*n is > > s*n" has the same complexity than "s*n == s*n" in CPython, right ?

RE: Unicode Error

2006-08-23 Thread Tim Golden
[Gallagher, Tim (NE)] | Hey all I am learning Python and having a fun time doing so. | I have a question for y'all, it has to do with active directory. | I want to get the last login for a computer from Active | Directory. I am using the active_directory module and here | is my code. [START

Re: how do you get the name of a dictionary?

2006-08-23 Thread Steven D'Aprano
On Wed, 23 Aug 2006 02:44:28 -0500, Robert Kern wrote: >> But consider that when you get an >> exception that says "a is too short", you often have to mentally change >> gears and think about where a came from and what it is called in the >> enclosing scope. After all, if the value of a is invalid

Re: Python and STL efficiency

2006-08-23 Thread Maric Michaud
Tim, sorry for I send it to you personally, I was abused by thunderbird. Tim N. van der Leeuw a écrit : > > Your C++ version got me the following timings (using gcc 3.4.5 as the > compiler, MinGW version, with -O6): > > ... > > > Hmmm... Can we conclude now that carefully crafted C++ code is

Re: Create a Multilanguage PDF in Python

2006-08-23 Thread Rob Wolfe
Perseo wrote: > Nothing to do! > I enable test2.py and the folder with 777 permission and I write at the > top of the file the PYTHONPATH "#!/usr/bin/python" as you told me but > it doesn't works as well. #!/usr/bin/python is not PYTHONPATH. I think you should read this: http://docs.python.org/tu

Re: What do you want in a new web framework?

2006-08-23 Thread Paul Boddie
Cliff Wells wrote: > > I disagree. Even if most of the frameworks end up being nothing more > than research artifacts, the fact is they embody research. Without > research the Python web framework space will be forever relegated to > runner-up (and probably has-been at some point). It's perhaps

Finding the type of indexing supported by an object?

2006-08-23 Thread Derek Peschel
Here are two functions. def invert_dict_to_lists(dict): lists = {} for key in dict: value = dict[key] if not value in lists: lists[value] = [key] else: lists[value].append(key) return lists def invert_list_to_lists(list): lists = {}

Re: how do you get the name of a dictionary?

2006-08-23 Thread Michael Janssen
jojoba wrote: > given any dictionary, get a name for it. You do not want to open your text editor and hardcode the name (neither as a variable name nor a name-attribute), do you? Your script is hopefully capable to determine the dict-to-be-displayed from user-input? Perhaps name of a file to be p

Creating a subpackage of a built-in module?

2006-08-23 Thread Derek Peschel
Can I add my own subpackages to modules that are written in C? I've put /Users/dpeschel/lib/python into my PYTHONPATH variable. Inside there, I've created a termios directory, and inside termios I've created __init__.py and signals.py. Now "import termios.signals" works, but "import termios" only

Re: Finding the type of indexing supported by an object?

2006-08-23 Thread Fredrik Lundh
Derek Peschel wrote: > I've thought about looking for keys(), looking for the special method names > that allow you to override indexing behavior, and looking at the class or > type of the object. I could be wrong, but I don't think any of those > strategies will work with all arguments. the beh

Re: Finding the type of indexing supported by an object?

2006-08-23 Thread Peter Otten
Derek Peschel wrote: > Here are two functions. > > def invert_dict_to_lists(dict): > lists = {} > for key in dict: > value = dict[key] > if not value in lists: > lists[value] = [key] > else: > lists[value].append(key) > return lists > >

Re: swapping numeric items in a list

2006-08-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Jiang Nutao wrote: > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > > How to do it fast? My real list is huge. Use the `array` module and the `array.byteswap()` method. Ciao, Marc 'BlackJack' Rintsch -- http://mail.py

Re: how do you get the name of a dictionary?

2006-08-23 Thread Fredrik Lundh
Steven D'Aprano wrote: > Here's a traceback. One of the arguments to spam() is too small. Can you > tell which one just by looking at the traceback? > a, b, c, d = range(4) spam(a, b, c, d) > Traceback (most recent call last): > File "", line 1, in ? > File "", line 6, in spam > File

Re: key not found in dictionary

2006-08-23 Thread Sion Arrowsmith
Chaz Ginger <[EMAIL PROTECTED]> wrote: >KraftDiner wrote: >> desc = self.numericDict[k][2] >> KeyError: 589824 < This is the error that is being produced, >As stated you can wrap the access in the try - except - else statement, >as in > >try: > foo['bar'] >except : > # Handle the erro

Re: idutils and Python

2006-08-23 Thread Fabio Zadrozny
> What exactly are you trying to accomplish?  If you want to index> function/class names, variables, etc then you should take a look at > "exuberant ctags" http://ctags.sourceforge.net53 --although it started> off as a C indexer, it has excellent Python support, it's free, and as> a bonus its indic

Re: Can I do this with list comprehension?

2006-08-23 Thread barberomarcelo
Thanks a lot to everybody. Marcelo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and STL efficiency

2006-08-23 Thread bearophileHUGS
This thread can be useful for ShedSkin (the Python => C++ translator), because often it manages strings slower than CPython still, some suggestions from a C++ expert can surely improve things a lot. C++ is fast, but you have to use and know it well, otherwise you don't obtain much speed. Maybe thi

Re: Python and STL efficiency

2006-08-23 Thread Mc Osten
Ray <[EMAIL PROTECTED]> wrote: > Yeah, my guess would be either he used the Debug configuration or he > actually created a Managed executable instead of a pure Win32 > application. Sigh, now I can't wait to get home and try it out :) Can be. But I suppose a Managed should not get *that* slow. Ir

find, replace and save string in ascii file

2006-08-23 Thread peter
Hello all, I'm looking for an advice. Example (one block in ascii file): $ NAME='ALFA' CODE='x' $ There are many similar blocks in the file with different NAMEs and different CODEs. What I'm looking for is a script that searchs through whole file a

Re: swapping numeric items in a list

2006-08-23 Thread Boris Borcic
Jiang Nutao wrote: > Hi, > > I simplify my problem like below > > To convert list > aa = [0x12, 0x34, 0x56, 0x78] > into > [0x34, 0x12, 0x78, 0x56] > > How to do it fast? My real list is huge. Mark Rintsch's suggestion appears best if applicable, but just to cite yet other ways to do

Re: find, replace and save string in ascii file

2006-08-23 Thread Amit Khemka
On 23 Aug 2006 05:48:37 -0700, peter <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm looking for an advice. > > Example (one block in ascii file): > $ > NAME='ALFA' > CODE='x' > $ > > There are many similar blocks in the file with different NAMEs and

Re: Python and STL efficiency

2006-08-23 Thread Tim N. van der Leeuw
Mc Osten wrote: > Ray <[EMAIL PROTECTED]> wrote: > > > Yeah, my guess would be either he used the Debug configuration or he > > actually created a Managed executable instead of a pure Win32 > > application. Sigh, now I can't wait to get home and try it out :) > > Can be. But I suppose a Managed sh

Re: find, replace and save string in ascii file

2006-08-23 Thread peter
Thank you for your advice. I'm not so good in python yet, so could you be so kind and write me a piece of code for the part If you want the output to be written to same file just 'move' this temperory file to the input file once you are done. Because that's what I don't know how to do it. How

Re: find, replace and save string in ascii file

2006-08-23 Thread Andy Terrel
Take your code, pretend it is in file: $ NAME='ALFA' CODE='x' $ a python functions could be: def change(filename): fp = open(filename, 'r') lines = fp.readlines() fp.close() for i in range(len(lines)): if lines[i].find('NA

Re: idutils and Python

2006-08-23 Thread Ramon Diaz-Uriarte
On 22 Aug 2006 10:04:12 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > That's usually cscope http://cscope.sourceforge.net/ but I've not > tried to use it with Python before; from the web page it looks like it > may be worth a spin: > "The fuzzy parser supports C, but is flexible enough to

Re: idutils and Python

2006-08-23 Thread Ramon Diaz-Uriarte
Thanks for the answer. I had read about PyDev and its extenssions but, if at all possible, I'd like to keep working with Emacs (or Vim) instead of Eclipse, and I'd rather use free/open source software. Best, R. On 8/23/06, Fabio Zadrozny <[EMAIL PROTECTED]> wrote: > > > > > > > What exactly are

Re: Python bindings for picasaweb ...

2006-08-23 Thread Andy Terrel
sweet. I'll definitely be trying to use this. [EMAIL PROTECTED] wrote: > Just a post to announce some python bindings for picasaweb (photo's > service of google). > ---> PycasaWeb (GPL), http://manatlan.infogami.com/pycasaweb > I think it may be usefull for linux users, because it's one of the o

Python-like C++ library

2006-08-23 Thread Will McGugan
Hi folks, I'm forced to use C++ and STL at work, and consequently miss the ease of use of Python. I was wondering if there was a C++ library that implemented the fundamental objects of Python as close as possible, perhaps using STL underneath the hood. Too clarify, Im not looking to interface C++

Re: Python and STL efficiency

2006-08-23 Thread Ray
Tim N. van der Leeuw wrote: > With the nr of loops corrected, Python on my laptop performs worse than > C++ under all circumstances, by a factor of about 2: *Phew* Great to know that my model of how the world works is still correct! (at least in relation to Python and C++!) :) Thanks, Ray > >

Re: find, replace and save string in ascii file

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 09:48, peter wrote: What I did is that I can find all strings which I need, next I change these strings based on CODE, but what I can't is to replace old string with new one, on the same position in the file. It always writes new string at the end of the file. Here is my c

How to download a web page just like a web browser do ?

2006-08-23 Thread Bo Yang
Hi , It is about one month passed since I post to this list last time . Yes , I use python , I used it in every day normal work , whenever I need to do some scripts or other little-scale works , python is the first one I took consideration in . I must say it is a powerful tool for me , and wha

callable to disappear?

2006-08-23 Thread Antoon Pardon
I have been reading http://www.python.org/dev/peps/pep-3100/ en there is written: To be removed: ... callable(): just call the object and catch the exception ... But that doesn't seem to be a generally available option. The place where you want to check if something is call

Re: Finding the type of indexing supported by an object?

2006-08-23 Thread Alex Martelli
Derek Peschel <[EMAIL PROTECTED]> wrote: > Here are two functions. > > def invert_dict_to_lists(dict): > lists = {} > for key in dict: > value = dict[key] > if not value in lists: > lists[value] = [key] > else: > lists[value].append(key) >

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Bo Yang wrote: > Everyday , I receive a newsletter from NYTimes , but I > didn't want to read the news in evening the time the letter > came in . So , I am about to download the web page > contains the news and read them next morning ! I decide to > use python to write

Re: How can I enumerate all windows services and disable some of them?

2006-08-23 Thread Tim Golden
Tim Golden wrote: > [Tim Golden] > > | [EMAIL PROTECTED] > | > | | I know that Module win32service has some functions on manipulating > | | win32 services. > | | But I still have 2 questions: > | | 1. how to enumerate all services? > | | 2. how to disable a certain one? > | > | You can use WMI to

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Cyril Bazin
look at the modules urllib and urllib2, they both are provided with python : http://docs.python.org/lib/module-urllib.html http://docs.python.org/lib/module-urllib2.htmlAnd look at the examples :http://docs.python.org/lib/node483.html http://docs.python.org/lib/urllib2-examples.htmlOn 23 Aug 2006 0

Re: Python-like C++ library

2006-08-23 Thread Cyril Bazin
Look at boost and boost.python . In your case, bosst.python seems more interesting, but you take a look at boost it may  help you at work... http://www.boost.org/ http://www.boost.org/libs/python/doc/CyrilOn 23 Aug 2006 07:19:42 -0700, Will McGugan <[EMAIL PROTECTED] > wrote:Hi folks,I'm forced to

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 11:34, Bo Yang wrote: Everyday , I receive a newsletter from NYTimes , but I didn't want to read the news in evening the time the letter came in . So , I am about to download the web page contains the news and read them next morning ! I decide to use python to write a

Re: Permission Denied

2006-08-23 Thread Magnus Lycka
Jorge Godoy wrote: > ;-) And think about security as well. I.e. put '.' in the end of your PATH, never in the beginning! -- http://mail.python.org/mailman/listinfo/python-list

Re: Create a Multilanguage PDF in Python

2006-08-23 Thread Perseo
PERFECT! Done! Thanks Now I create a little file in pdf format but the data are in the MySql database! :( How can I connect to it? Thanks for all suggestions Perseo Rob Wolfe wrote: > Perseo wrote: > > Nothing to do! > > I enable test2.py and the folder with 777 permission and I write at the > >

Python + Java Integration

2006-08-23 Thread Chas Emerick
This may seem like it's coming out of left field for a minute, but bear with me. There is no doubt that Ruby's success is a concern for anyone who sees it as diminishing Python's status. One of the reasons for Ruby's success is certainly the notion (originally advocated by Bruce Tate, if

Re: How to download a web page just like a web browser do ?

2006-08-23 Thread Max Penet
You can also try HarvestMan: http://harvestman.freezope.org/ Bo Yang wrote: > Hi , > It is about one month passed since I post to this list > last time . Yes , I use python , I used it in every day normal > work , whenever I need to do some scripts or other little-scale > works , python is

ANN: Urwid 0.9.6 - Console UI Library

2006-08-23 Thread Ian Ward
Announcing Urwid 0.9.6 -- Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.6.tar.gz About this release: === This release improves Unicode support with Python < 2.4 and new features were added to the tutorial and ref

Re: Python + Java Integration

2006-08-23 Thread Ben Sizer
Chas Emerick wrote: > There is no doubt that Ruby's success is a concern for anyone who > sees it as diminishing Python's status. One of the reasons for > Ruby's success is certainly the notion (originally advocated by Bruce > Tate, if I'm not mistaken) that it is the "next Java" -- the language >

Re: MS SQL Server: NT Authentication. Possible?

2006-08-23 Thread Dirk Hagemann
I already mentioned, that it the following works when it's NOT executed by the webserver: > > import adodbapi > db = adodbapi.connect ("Provider=sqloledb;Data Source=VODEV1;Initial > Catalog=EVOBACK;Integrated Security=SSPI;") > q = db.cursor () > q.execute ("SELECT SYSTEM_USER") > print q.fetcho

Re: idutils and Python

2006-08-23 Thread Fabio Zadrozny
On 8/23/06, Ramon Diaz-Uriarte <[EMAIL PROTECTED]> wrote: Thanks for the answer. I had read about PyDev and its extenssions but,if at all possible, I'd like to keep working with Emacs (or Vim)instead of Eclipse, and I'd rather use free/open source software. Well, you can use only Pydev without the

Re: Python + Java Integration

2006-08-23 Thread Diez B. Roggisch
Chas Emerick wrote: > This may seem like it's coming out of left field for a minute, but > bear with me. > > There is no doubt that Ruby's success is a concern for anyone who > sees it as diminishing Python's status. One of the reasons for > Ruby's success is certainly the notion (originally adv

Re: Python + Java Integration

2006-08-23 Thread hiaips
> Java itself never deserved to be the 'next' anything anyway. It was > sold on hype and has never lived up to it. I can see your point from a > business perspective but I like to think Python is sold on its merits > and not on being the new panacea for middle managers to deploy. Bravo. I could

Re: Python + Java Integration

2006-08-23 Thread Chas Emerick
On Aug 23, 2006, at 11:50 AM, Ben Sizer wrote:Chas Emerick wrote: There is no doubt that Ruby's success is a concern for anyone who sees it as diminishing Python's status.  One of the reasons for Ruby's success is certainly the notion (originally advocated by Bruce Tate, if I'm not mistaken) that i

Accessing application data portably

2006-08-23 Thread Tom E H
My Python application includes some data files that need to be accessed by modules I distribute with it. Where can I put them, and how should I arrange my code, so that it works across platforms? On Linux, I could install the data to "/usr/lib/myprogram/datafile", and on Windows to "datafile" rel

Re: Python and STL efficiency

2006-08-23 Thread skip
Ray> Same here, although that said Python's implementation of those data Ray> structure must already be as optimal as mortals can do it. Perhaps more optimal. We've had (tim)bots working on the problem for years. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Create a Multilanguage PDF in Python

2006-08-23 Thread Perseo
It's too difficult for me, anyone can help me contact me thru chat or something else, please. It drives me crazy! Perseo wrote: > PERFECT! Done! Thanks > Now I create a little file in pdf format but the data are in the MySql > database! :( > How can I connect to it? > > Thanks for all suggestions

Re: how do you get the name of a dictionary?

2006-08-23 Thread jojoba
Fredrik Lundh wrote: > the fact that despite all attempts to explain how things work, you're > still haven't realized that if you want the names of things, you should > pass *namespaces* to your object viewer, not individual objects. And what im saying is that isnt it silly that we need pass a

RE: MS SQL Server: NT Authentication. Possible?

2006-08-23 Thread Tim Golden
[Dirk Hagemann] | Now I found this work-around: [... snip opening restricted file ...] | And this works! [...] So on the one hand the IIS works fine with the | fileserver, but the IIS does not work with the SQL-Server. And it seems | not to be the fault of the code, because it works when it's e

Re: Python-like C++ library

2006-08-23 Thread bearophileHUGS
Will McGugan: > I was wondering if there was a C++ library that > implemented the fundamental objects of Python as close as possible, > perhaps using STL underneath the hood. > Too clarify, Im not looking to interface C++ with Python in any way, > just to emulate the strings / containers / slicing

Re: how do you get the name of a dictionary?

2006-08-23 Thread Simon Brunning
On 23 Aug 2006 09:29:40 -0700, jojoba <[EMAIL PROTECTED]> wrote: > And what im saying is that isnt it silly that we need pass an entire > namespace, when a much simpler notion would be to have each object know > its own name(s) (even if that name doesnt exist). > Now, here's where everyone tells me

Re: how do you get the name of a dictionary?

2006-08-23 Thread jojoba
> And what im saying is that isnt it silly that we need pass an entire > namespace, when a much simpler notion would be to have each object know > its own name(s) (even if that name doesnt exist). please note: in my above comment, i was completely disregarding any notions of added costs that wo

Re: Python and STL efficiency

2006-08-23 Thread skip
>> Yes it is. But of course you can't sat that "Python is faster than >> C++". Harald> Of course not. Python is faster then assembler. Proofed @ Harald> EuroPython 2006 in CERN, near the LHC Beta, in the same room Harald> many Nobel laurates gave their presentations before. H

Re: how do you get the name of a dictionary?

2006-08-23 Thread Georg Brandl
jojoba wrote: >> And what im saying is that isnt it silly that we need pass an entire >> namespace, when a much simpler notion would be to have each object know >> its own name(s) (even if that name doesnt exist). > > > please note: in my above comment, i was completely disregarding any > notion

Re: find, replace and save string in ascii file

2006-08-23 Thread Roberto Bonvallet
peter wrote: > Example (one block in ascii file): > $ > NAME='ALFA' > CODE='x' > $ > > There are many similar blocks in the file with different NAMEs and > different CODEs. What I'm looking for is a script that searchs through > whole file and finds

Re: Python + Java Integration

2006-08-23 Thread Chas Emerick
On Aug 23, 2006, at 12:30 PM, Diez wrote: - ruby has no notion of java-library support. So if anything lures java developers from J2EE-land to rails, its the framework itself. Which, by my standards, is at least met if not excelled by TurboGears and Django. So it's marketing, but of a different kin

Re: Text to MP3 using pyTTS - Non-programmer question

2006-08-23 Thread seyeRMReyes
Thanks for much for all the help, but it doesn't seem as if the wav file is being created, but I really don't get an error message. Initially, I got error messages about TCL and TK lidbrary and I added them to the PATH. Do the encoder need to be in the source folder along with the code? Again, I

Re: how do you get the name of a dictionary?

2006-08-23 Thread Robert Kern
jojoba wrote: > > Fredrik Lundh wrote: >> the fact that despite all attempts to explain how things work, you're >> still haven't realized that if you want the names of things, you should >> pass *namespaces* to your object viewer, not individual objects. > > And what im saying is that isnt it sil

Re: Python and STL efficiency

2006-08-23 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > >> Yes it is. But of course you can't sat that "Python is faster than > >> C++". > > Harald> Of course not. Python is faster then assembler. Proofed @ > Harald> EuroPython 2006 in CERN, near the LHC Beta, in the same room > Harald> many Nobel laurates gave the

running windows 'start' cmd using spawnl

2006-08-23 Thread Tor Erik
Hi, I need to start a program in a new cmd-window. To do this I need to execute: start [command] With os.system this is straight-forward. But I need to do it with spawnl and P_NOWAIT. I.e, asynchronously. The problem is that I need to know the path where start resides, which I'm unable to find.

Re: Create a Multilanguage PDF in Python

2006-08-23 Thread Perseo
Hi Rob this is my code: #!/usr/bin/python import time, os, sys from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfgen import canvas from reportlab.lib.units import inch, cm from reportlab.lib.pagesizes import A4 #precalculate some basics top_

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
Thank you all guys for the help. Guess I'm gonna pick bearophile's way. It's fast, neat, and easy to read. array.byteswap() won't work for me easily. I tried this before my 1st post. I defined aa = array('H', [0x12, 0x34, 0x56, 0x78]) Then did byteswap aa.byteswap(). The result was ar

Re: callable to disappear?

2006-08-23 Thread faulkner
what's wrong with hasattr(obj, '__call__')? Antoon Pardon wrote: > I have been reading http://www.python.org/dev/peps/pep-3100/ > en there is written: > > To be removed: > ... > > callable(): just call the object and catch the exception > > ... > > But that doesn't seem to be a ge

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 14:22, Tor Erik wrote: I need to start a program in a new cmd-window. To do this I need to execute: start [command] With os.system this is straight-forward. But I need to do it with spawnl and P_NOWAIT. I.e, asynchronously. The problem is that I need to know the path where

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 14:44, Jiang Nutao wrote: array.byteswap() won't work for me easily. I tried this before my 1st post. I defined aa = array('H', [0x12, 0x34, 0x56, 0x78]) Then did byteswap aa.byteswap(). The result was array('H', [0x1200, 0x3400, 0x5600, 0x7800]) You can see it

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
This is what I got in the debugger: (Pdb) aa=array('b', [126, 55, 71, 112]) (Pdb) aa array('b', [126, 55, 71, 112]) (Pdb) aa.byteswap() (Pdb) aa array('b', [126, 55, 71, 112]) - Original Message - From: "Gabriel Genellina" <[EMAIL PROTECTED]> To: "Jiang Nutao" <[EMAIL PROTECTED]> Cc: Se

Regex help...pretty please?

2006-08-23 Thread MooMaster
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: cond(c,a,b) but it gets a little more complicated because the conds themselves may have conds within, like the

Re: how do you get the name of a dictionary?

2006-08-23 Thread Fredrik Lundh
jojoba wrote: >> the fact that despite all attempts to explain how things work, you're >> still haven't realized that if you want the names of things, you should >> pass *namespaces* to your object viewer, not individual objects. > > And what im saying is that isnt it silly that we need pass an e

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Fredrik Lundh
Tor Erik wrote: > I need to start a program in a new cmd-window. To do this I need to > execute: start [command] > With os.system this is straight-forward. > But I need to do it with spawnl and P_NOWAIT. I.e, asynchronously. > The problem is that I need to know the path where start resides, > whi

Re: how do you get the name of a dictionary?

2006-08-23 Thread Fredrik Lundh
Steve Holden wrote: > Right. Plus it's fun to imagine the effbot hitting itself as hard as > some people would obviously have liked to hit it in the past :-) you mean the guy who's spent the last six months downrating every single post I've made on this list over at googlegroups ? I'd say it's

Dr. Dobb's Python-URL! - weekly Python news and links (Aug 23)

2006-08-23 Thread Jack Diederich
QOTW: "Because there's no chance that the original request is sane." - Georg Brandl (responding to a question involving a Banana) "this is one of your last chances to test the new code in 2.5 before the final release. *Please* try this release out and let us know about any problems you find" - An

Re: Python + Java Integration

2006-08-23 Thread Fredrik Lundh
Ben Sizer wrote: > Java itself never deserved to be the 'next' anything anyway. I've had a lot of developers come up to me and say, "I haven't had this much fun in a long time. It sure beats writing Cobol" -- James Gosling -- http://mail.python.org/mailman/listinfo/python-list

Re: swapping numeric items in a list

2006-08-23 Thread Fredrik Lundh
Jiang Nutao wrote: > array.byteswap() won't work for me easily. I tried this before my 1st post. > I defined > > aa = array('H', [0x12, 0x34, 0x56, 0x78]) > > Then did byteswap aa.byteswap(). The result was > > array('H', [0x1200, 0x3400, 0x5600, 0x7800]) > > You can see it byteswappe

Re: Regex help...pretty please?

2006-08-23 Thread Tim Chase
> cond(a,b,c) > > and I want them to look like this: > > cond(c,a,b) > > but it gets a little more complicated because the conds themselves may > have conds within, like the following: > > cond(0,cond(c,cond(e,cond(g,h,(ahttp://mail.python.org/mailman/listinfo/python-list

Re: swapping numeric items in a list

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 15:32, Jiang Nutao wrote: This is what I got in the debugger: (Pdb) aa=array('b', [126, 55, 71, 112]) (Pdb) aa array('b', [126, 55, 71, 112]) (Pdb) aa.byteswap() (Pdb) aa array('b', [126, 55, 71, 112]) Oh, sorry, to swap by two bytes "H" was the right typecode. But your

Class instantiation

2006-08-23 Thread Colin J. Williams
In the example below, with the disassembly following that, we run into trouble with the line: self.connect(fileID, mode= 'r') # open sheet in the read mode the traceback is: Traceback (most recent call last): File "C:\Documents and Settings\cjw\My Documents\OODev\tArray.py", line 26

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
Thanks. But the thing I need to swap is [0x12, 0x34, 0x56, 0x78], not [0x1234, 0x5678]. - Original Message - From: "Gabriel Genellina" <[EMAIL PROTECTED]> To: "Jiang Nutao" <[EMAIL PROTECTED]> Cc: "Gabriel Genellina" <[EMAIL PROTECTED]>; Sent: Wednesday, August 23, 2006 12:19 PM Subject

setting a breakpoint in the function of my module

2006-08-23 Thread Jason Jiang
Hi, I have two modules: a.py and b.py. In a.py, I have a function called aFunc(). I'm calling aFunc() from b.py (of course I import module a first). The question is how to directly set a breakpoint in aFunc(). The way I'm doing now is to set a breakpoint in b.py at the line to call aFunc(), 'c

Re: running windows 'start' cmd using spawnl

2006-08-23 Thread Michel Claveau
Hi! You can use (exemple) : "cmd /cSTART notepad" -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Class instantiation

2006-08-23 Thread Gabriel Genellina
At Wednesday 23/8/2006 16:21, Colin J. Williams wrote: In the example below, with the disassembly following that, we run into trouble with the line: NameError: global name 'fileID' is not defined At line 26, location 31, why is LOAD_GLOBAL generated for fileId, when LOAD_FAST has done the job a

  1   2   >