Leipzig Python User Group - Meeting, March 16 2006, 8:00pm

2006-03-10 Thread Mike Mueller
= Leipzig Python User Group = Second Meeting Thursday, March 16 2006 -- We will meet on March 16 at 8:00pm at the training center of Python Academy, Zur Schule 20, 04158 Leipzig; Germany (How to get there:

RPyC 2.40

2006-03-10 Thread tomerfiliba
hello pythoneers, last week i released RPyC 2.40 -- http://rpyc.sf.net -- but didnt have time to announce it. also, i updated the site and added sections. i'm not going to repeat the code snippet from the previous release (2.32), you can see full demos on the site. so, of course this release

ANN: pyregex 0.5

2006-03-10 Thread aurora
pyregex is a command line tools for constructing and testing Python's regular _expression_. Features includes text highlighting, detail break down of match groups, substitution and a syntax quick reference. It is released in the public domain. Screenshot and download from

Re: embedding Python: how to avoid memory leaks?

2006-03-10 Thread Martin v. Löwis
Torsten Bronger wrote: I couldn't get the PyRun_*File* calls to work on Windows, presumably because of the FILE* problem mentioned in the docs. Well, I don't really *know*, but it's hard to believe to me that the file descriptor format changed within the Microsoft product series. The layout of

Re: Simple questions on use of objects (probably faq)

2006-03-10 Thread Brian Elmegaard
Michael [EMAIL PROTECTED] writes: Based on the code that runs, you want* this: [(y[x+1].x-y[x].x) for x in range(len(y)-1) ] Yes. Since personally I find that a lot clearer than: map(float.__sub__, [X.x for X in y[1:]], [X.x for X in y[:-1] ]) Me too. -- Brian (remove the sport for

Re: Simple questions on use of objects (probably faq)

2006-03-10 Thread Brian Elmegaard
Steven D'Aprano [EMAIL PROTECTED] writes: With this method in the class, your solution is easier than ever: Nice solution. -- Brian (remove the sport for mail) http://www.et.web.mek.dtu.dk/Staff/be/be.html http://www.rugbyklubben-speed.dk --

Re: creating variable in root namespace from module

2006-03-10 Thread Steve Holden
MakaMaka wrote: Hi, I have a scope related question that I haven't been able to find an answer to anywhere. Is there a way to have a function in an imported module add variables to the scope of the calling script? Basically, can I have the following: #root.py import some_module.py

Re: How to pop random item from a list?

2006-03-10 Thread Peter Otten
marduk wrote: item = mylist.pop(random.randint(0,len(mylist))) This is broken because randint(a, b) may return b. I prefer randrange(len(mylist)) over randint(0, len(mylist)-1) as a fix. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Evangelism

2006-03-10 Thread Thomas G. Willis
...In any case, I'm sure Django was a great musician, but theproduct needs a better name to have any chance of displacing Rails. |oug Yes he was an amazing guitarist. If you ever listen to his stuff, keep in mind he had 2 working fingers on his fret hand, and ripping on a guitar that would be

Password entering system

2006-03-10 Thread Tuvas
I want to write a GUI program (Preferably in Tkinter) that will allow for the entering of passwords, stared out like a normal program does. Is that possible? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

API/C memory mananegemnt problem

2006-03-10 Thread fumana
Hi everybody, I have a problem with Python/C API and memory management. I'm using Python 2.3.5 (#1, Jan 4 2006, 16:44:27) [GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2 In my C-module I have a loop like this: *** int size=1000;

Re: First script, please comment and advise

2006-03-10 Thread bruno at modulix
Pedro Graca wrote: [EMAIL PROTECTED] wrote: My version is similar to Just one: from random import shuffle def scramble_text(text): Return the words in input text string scrambled except for the first and last letter. def scramble_word(word): Nice. You can have functions

Re: Python Evangelism

2006-03-10 Thread Kay Schluehr
Magnus Lycka wrote: They do this on purpose in the U.S. A country full of religious fanatics, where it's impossible to be elected president unless you claim that you are a devoted Christian and say God bless America every time you open your mouth. Maybe Pythonistas should make a cultural

Re: API/C memory mananegemnt problem

2006-03-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: In my C-module I have a loop like this: *** int size=1000; output=(double *) calloc(size, sizeof(double)); py_output=PyList_New(0); for(i=0; isize; i++){ tmp=PyFloat_FromDouble(output[i]);

Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Dmitry Anikin
I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload resolution, isn't it?) and when calling, just omit parameter when you want to use defaults:

Re: embedding Python: how to avoid memory leaks?

2006-03-10 Thread Wolfgang
Hallo, I couldn't get the PyRun_*File* calls to work on Windows, presumably because of the FILE* problem mentioned in the docs. Which compiler do you use? MSVC++ (version 6 from memory -- I do most of my development on the Mac and fire up Virtual PC occasionally to test Win builds).

API/C memory mananegemnt problem

2006-03-10 Thread Marco Fumana
Thank for your help. I have try to follow your suggestion but I seem to fail. Now my C-module (call it C_Core) code is: *** /* create_list function */ int size=1000; output=(double *) calloc(size, sizeof(double)); py_output=PyList_New(0);

Re: Python Evangelism

2006-03-10 Thread Tim Churches
Kay Schluehr wrote: Magnus Lycka wrote: They do this on purpose in the U.S. A country full of religious fanatics, where it's impossible to be elected president unless you claim that you are a devoted Christian and say God bless America every time you open your mouth. Maybe Pythonistas

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Duncan Booth
Dmitry Anikin wrote: Is there some contradiction in python syntax which disallows an easy implementation of this feature, or just nobody bothered with this? If former is the case, please show me why, because I badly need this feature in embedded python app (for compatibility with other

Re: Help with a reverse dictionary lookup

2006-03-10 Thread bruno at modulix
rh0dium wrote: Hi all, I have a dict which looks like this.. dict={'130nm': {'umc': ['1p6m_1.2-3.3_fsg_ms']}, '180nm': {'chartered': ['2p6m_1.8-3.3_sal_ms'], 'tsmc': ['1p6m_1.8-3.3_sal_log', '1p6m_1.8-3.3_sal_ms']}, '250nm': {'umc': ['2p6m_1.8-3.3_sal_ms'], 'tsmc':

Embedded Python

2006-03-10 Thread John Dean
Hi Is it possible to execute a whole script using the C API function PyRun_String? At moment I load the script into a buffer. Then I get each line of the script and pass it PyRun_String. This seems very inefficient. It would be more efficient if I could pass the complete string buffer to

Re: Python Evangelism

2006-03-10 Thread Juho Schultz
Magnus Lycka wrote: rtilley wrote: I think it's the name. Python. Let's change it to something nicer. Think about it... if you found a Ruby, you'd pick it up and put it in your pocket. If you ran across a Python, you'd run away. I think you have a point, but I also think it's a bit

Re: Embedded Python

2006-03-10 Thread Fredrik Lundh
John Dean wrote: Is it possible to execute a whole script using the C API function PyRun_String? At moment I load the script into a buffer. Then I get each line of the script and pass it PyRun_String. This seems very inefficient. It would be more efficient if I could pass the complete string

Re: Python Evangelism

2006-03-10 Thread Ant
It's not too late to rename the cheese shop though. (We don't need even more stink...) What kind of cheese do you guys eat anyway ;-) It's not the names that are the problem as far as markleing goes - they are not dull names, which means they won't be forgotten. This is a good thing! As is the

Re: Python Evangelism

2006-03-10 Thread Terry Hancock
On Thu, 9 Mar 2006 19:33:38 -0500 Thomas G. Willis [EMAIL PROTECTED] wrote: On 3/9/06, Terry Hancock [EMAIL PROTECTED] wrote: On Thu, 9 Mar 2006 10:33:12 -0500 Thomas G. Willis [EMAIL PROTECTED] wrote: I get particulalry annoyed now with linux when I start up synaptic and my choices

Re: Best way to have a for-loop index?

2006-03-10 Thread Terry Hancock
On 9 Mar 2006 16:32:24 -0800 [EMAIL PROTECTED] wrote: I write a lot of code that looks like this: for myElement, elementIndex in zip( elementList, range(len(elementList))): print myElement , myElement, at index: ,elementIndex My question is, is there a better, cleaner, or easier

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Terry Hancock
On 10 Mar 2006 09:51:01 GMT Duncan Booth [EMAIL PROTECTED] wrote: Dmitry Anikin wrote: Is there some contradiction in python syntax which disallows an easy implementation of this feature, or just nobody bothered with this? If former is the case, please show me why, because I badly need

Re: Python Evangelism

2006-03-10 Thread Terry Hancock
On Fri, 10 Mar 2006 20:44:55 +1100 Tim Churches [EMAIL PROTECTED] wrote: I think that Glykon should be invited to be the sponsoring divinity for PyCon next year. I hear that worship of pagan gods is, like everything else, bigger in Texas. Ignoring the silly Python jokes, *is* PyCON going to be

Re: urlerror, urllib2: no address ... why or debug tips?

2006-03-10 Thread Rene Pijlman
[EMAIL PROTECTED]: Help please with a URLError. Post your code (a small self-contained example, preferrably) and the URL. -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Evangelism

2006-03-10 Thread Steve Holden
Terry Hancock wrote: On Fri, 10 Mar 2006 20:44:55 +1100 Tim Churches [EMAIL PROTECTED] wrote: I think that Glykon should be invited to be the sponsoring divinity for PyCon next year. I hear that worship of pagan gods is, like everything else, bigger in Texas. Ignoring the silly Python

[wxPython] howto prevent Frame reszing?

2006-03-10 Thread Cell
Hi, I have searched for this but the only thing I can find is somebody that tells wx.RESIZE_BORDER is the style to look for. When I apply this in my code I am still able to resize the frame. Somebody can help me here? For example: class FrameName(wx.MiniFrame): def __init__( self,

Re: A bit OT: Python prompts display as nested mail quotes in Thunderbird

2006-03-10 Thread Joel Hedlund
They already ARE plain text (I don't know of anyone submitting MIME/HTML enhanced content on this group). I know. it would mean all other quoted text would not look quoted in your reader. I.e. they would have '' chars at line start. That is *excatly* what I want and what I asked in my post.

Re: A better RE?

2006-03-10 Thread Eddie Corns
Magnus Lycka [EMAIL PROTECTED] writes: I want an re that matches strings like 21MAR06 31APR06 1236, where the last part is day numbers (1-7), i.e it can contain the numbers 1-7, in order, only one of each, and at least one digit. I want it as three groups. I was thinking of Just a small point -

Re: A better RE?

2006-03-10 Thread Fredrik Lundh
Eddie Corns wrote: I want an re that matches strings like 21MAR06 31APR06 1236, where the last part is day numbers (1-7), i.e it can contain the numbers 1-7, in order, only one of each, and at least one digit. I want it as three groups. I was thinking of Just a small point - what does in

Which GUI toolkit is THE best?

2006-03-10 Thread invitro81
Hello I've recently learnt python and I do love it! I congratulate all those geeks who produce this nice language; well, because I could be called a nearby newbee I've decided to improve my abilities by writing my own nice editor with python; so I've to choose among all those GUI toolkit's

Re: A better RE?

2006-03-10 Thread Jim
Eddie Corns wrote: Just a small point - what does in order mean here? if it means that eg 1362 is not valid then you're stuck because it's context sensitive and hence not regular. I'm not seeing that. Any finite language is regular -- as a last resort you could list all ascending sequences of

how to validate a proxy is alive?

2006-03-10 Thread JuHui
If a proxy is alive then return true, else return fals after 1 second. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: A better RE?

2006-03-10 Thread Eddie Corns
Fredrik Lundh [EMAIL PROTECTED] writes: Eddie Corns wrote: I want an re that matches strings like 21MAR06 31APR06 1236, where the last part is day numbers (1-7), i.e it can contain the numbers 1-7, in order, only one of each, and at least one digit. I want it as three groups. I was thinking

Re: how to validate a proxy is alive?

2006-03-10 Thread Rene Pijlman
JuHui: If a proxy is alive then return true, else return fals after 1 second. What kind of proxy? Design pattern? Protocol? Which one? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: A bit OT: Python prompts display as nested mail quotes in Thunderbird

2006-03-10 Thread Joel Hedlund
Do you have the Quote Colors extension? I do now. :-) You can also disable the use of colors in the options, but that will remove the colors for all messages. Or I can tell it to display colored '' chars. Marvellous! Thanks for the advice! You're a real help. /Joel Hedlund --

open2 problem

2006-03-10 Thread mapik . ua
Hi. I have such problem with os.popen2 function: //test.py file #!/usr/local/bin/python print start x= raw_input() print end //main.py file #!/usr/local/bin/python import os i,o = os.popen2('./tester.py') print o.readline() i.write(hi) print o.readline() i.close() o.close() When I

Re: how to validate a proxy is alive?

2006-03-10 Thread JuHui
I want to get a html page content via a http proxy. befor this, I want to check the proxy. how to validate it? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Which GUI toolkit is THE best?

2006-03-10 Thread Peter Decker
On 3/10/06, invitro81 [EMAIL PROTECTED] wrote: But I've no idea which one I should use to start with.. I've read that tkinter seems to be the de facto standart in the pyhon community; but why? Is it the best available one or are theire other reasons? I read also a litte about wxpython and

Re: Which GUI toolkit is THE best?

2006-03-10 Thread Cell
invitro81 schreef: Hello I've recently learnt python and I do love it! I congratulate all those geeks who produce this nice language; well, because I could be called a nearby newbee I've decided to improve my abilities by writing my own nice editor with python; so I've to choose among all

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide just several of them. In fact, I can do it using keyword parameters, but it's rather long and you have to remember/lookup names

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Steve Holden
Dmitry Anikin wrote: I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload resolution, isn't it?) I've no idea why C++ required defaults last; it

Re: how to validate a proxy is alive?

2006-03-10 Thread robert
JuHui wrote: I want to get a html page content via a http proxy. befor this, I want to check the proxy. how to validate it? thanks most simple by a socket-connect / error if non-existing: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('nonexisting-proxy-server',3129))

Re: open2 problem

2006-03-10 Thread Felipe Almeida Lessa
Em Sex, 2006-03-10 às 04:49 -0800, [EMAIL PROTECTED] escreveu: Hi. I have such problem with os.popen2 function: Why don't you use the subprocess module? See http://docs.python.org/lib/module-subprocess.html -- Quem excele em empregar a força militar subjulga os exércitos dos outros povos sem

Re: how to validate a proxy is alive?

2006-03-10 Thread JuHui
cool! thanks ! -- http://mail.python.org/mailman/listinfo/python-list

Re: open2 problem

2006-03-10 Thread mapik . ua
Why don't you use the subprocess module? I have tried subprocess module and got the same problem -- http://mail.python.org/mailman/listinfo/python-list

Re: A better RE?

2006-03-10 Thread Eddie Corns
Jim [EMAIL PROTECTED] writes: Eddie Corns wrote: Just a small point - what does in order mean here? if it means that eg 1362 is not valid then you're stuck because it's context sensitive and hence not regular. I'm not seeing that. Any finite language is regular -- as a last resort you could

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Antoon Pardon
Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide just several of them. In fact, I can do it using keyword parameters, but it's

Re: Which GUI toolkit is THE best?

2006-03-10 Thread Eric Brunel
On Fri, 10 Mar 2006 13:36:18 +0100, invitro81 [EMAIL PROTECTED] wrote: Hello I've recently learnt python and I do love it! I congratulate all those geeks who produce this nice language; well, because I could be called a nearby newbee I've decided to improve my abilities by writing my own

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Diez B. Roggisch
Antoon Pardon wrote: Specifying the names of the keyword parameters costs you a little typing once, but saves everybody (including yourself) a lot of grief later when you're trying to figure out what the heck your code does 6 months later. Could you explain what is so hard in figuring out:

Re: A better RE?

2006-03-10 Thread Paul McGuire
Magnus Lycka [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want an re that matches strings like 21MAR06 31APR06 1236, where the last part is day numbers (1-7), i.e it can contain the numbers 1-7, in order, only one of each, and at least one digit. I want it as three groups. I was

import and shared global variables

2006-03-10 Thread Michael Brenner
Hi, I'm implementing a plugin-based program, structured like the example below (where m1 in the main module, loading m2 as a plugin). I wanted to use a single global variable (m1.glob in the example) to store some config data that the plugins can access. However, the output shown belown seems

import and shared global variables

2006-03-10 Thread Michael Brenner
Hi, I'm implementing a plugin-based program, structured like the example below (where m1 in the main module, loading m2 as a plugin). I wanted to use a single global variable (m1.glob in the example) to store some config data that the plugins can access. However, the output shown belown

Adding Multiple Attachments to SMTP mail (msg.add_header)

2006-03-10 Thread EdWhyatt
Hi all, I hope there is someone out there who can help me out - it has to be something obvious. I am simulating mail traffic, and want to include multiple attachments to my mail. I have created a temporary array containing a number of files - for now just 2. Debugging my code, I can see that I

How to best update remote compressed, encrypted archives incrementally?

2006-03-10 Thread robert
Hello, I want to put (incrementally) changed/new files from a big file tree directly,compressed and password-only-encrypted to a remote backup server incrementally via FTP,SFTP or DAV At best within a closed algorithm inside Python without extra shell tools. (The method should work with

Re: Any python HTML generator libs?

2006-03-10 Thread Matt Goodall
Steve Holden wrote: Sullivan WxPyQtKinter wrote: Hi, everyone. Simply put, what I need most now is a python lib to generate simple HTML. I am now using XML to store my lab report records. I found python really convinient to manipulate XML, so I want to make a small on-line CGI program to help

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Roy Smith
In article [EMAIL PROTECTED], Antoon Pardon [EMAIL PROTECTED] wrote: Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide

Does -U option really exist?

2006-03-10 Thread Petr Prikryl
Martin v. Löwis once (20 Sep 2005) wrote in reply to my question... Simpler transition to PEP 3000 Unicode only strings? As for dropping the u prefix on string literals: Just try the -U option of the interpreter some time, which makes all string literals Unicode. If you manage to get the

Re: import and shared global variables

2006-03-10 Thread Tim Hochberg
Michael Brenner wrote: Hi, I'm implementing a plugin-based program, structured like the example below (where m1 in the main module, loading m2 as a plugin). I wanted to use a single global variable (m1.glob in the example) to store some config data that the plugins can access. However,

File Permissions

2006-03-10 Thread VJ
Hi All I need to get the user permission of a file using python. I was trying the following code which i found on google grups st = os.stat(myfile) mode = st[stat.ST_MODE] if mode stat.ST_IREAD: print readable if mode stat.ST_IWRITE: print writable if mode

Re: import and shared global variables

2006-03-10 Thread Diez B. Roggisch
I'm implementing a plugin-based program, structured like the example below (where m1 in the main module, loading m2 as a plugin). I wanted to use a single global variable (m1.glob in the example) to store some config data that the plugins can access. However, the output shown belown seems

Re: File Permissions

2006-03-10 Thread Sebastjan Trepca
Those constants are in stat module so add import stat before the program. On 10 Mar 2006 06:20:18 -0800, VJ [EMAIL PROTECTED] wrote: Hi All I need to get the user permission of a file using python. I was trying the following code which i found on google grups st = os.stat(myfile) mode

Re: Why python doesn't use syntax like function(,,x) for default parameters?

2006-03-10 Thread Juho Schultz
Antoon Pardon wrote: Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all having reasonable defaults, and I want to provide just several of them. In fact, I can do it using keyword

Python and C

2006-03-10 Thread diffuser78
I was a C Programmer for a while. Lately started to learn Python for one small project at school. I joined a small company where they use C++ for development. Can we use Python and C together ? I mean create some classes in Python and some number crunching algorithms coded in C (for speed) and

Re: File Permissions

2006-03-10 Thread Sybren Stuvel
VJ enlightened us with: Basically i want to write into a file .If the permissions are not there then print a error message. How do i achive this ??? f = file('somefile', 'w') then catch the exception that's thrown when it can't be done. Sybren -- The problem with the world is stupidity. Not

Re: creating an executable?

2006-03-10 Thread Larry Bates
John Salerno wrote: Well, now that I can time my laundry, I need to make it runnable. I tried looking for info on the freeze module in the help file, but it didn't seem to come up with much. According to the Python wiki, freeze is for making executables for Unix. Can I make an executable

Re: Python and C

2006-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: I was a C Programmer for a while. Lately started to learn Python for one small project at school. I joined a small company where they use C++ for development. Can we use Python and C together ? I mean create some classes in Python and some number crunching

Re: Python and C

2006-03-10 Thread Diez B. Roggisch
http://docs.python.org/api/api.html That should have been http://docs.python.org/ext/ext.html but you need the other one sooner or later. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: processing the genetic code with python?

2006-03-10 Thread brainy_muppet
I'm writing your name down and this is the last time I'm doing homework for you. James Wow, you are really a pretentious asshole. If you don't want to provide people with help, don't bother. And that code's incorrect anyway. -- http://mail.python.org/mailman/listinfo/python-list

Numbers in python

2006-03-10 Thread brainy_muppet
Basically, I have a code with is almost finished but I've having difficultly with the last stage of the process. I have a program that gets assigns different words with a different value via looking them up in a dictionary: eg if THE is in the writing, it assigns 0.965 and once the whole

Re: Password entering system

2006-03-10 Thread Tuvas
I actually decided to write my own, the thing I needed to know was the show option to entry. That was the key! -- http://mail.python.org/mailman/listinfo/python-list

Re: File Permissions

2006-03-10 Thread Juho Schultz
VJ wrote: Hi All Basically i want to write into a file .If the permissions are not there then print a error message. How do i achive this ??? Thanks, VJ One way would be a try-except block, and leave the permission checking error message generation, etc. to the operating system.

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

2006-03-10 Thread Larry Bates
EdWhyatt wrote: Hi all, I hope there is someone out there who can help me out - it has to be something obvious. I am simulating mail traffic, and want to include multiple attachments to my mail. I have created a temporary array containing a number of files - for now just 2. Debugging my

why use special config formats?

2006-03-10 Thread tomerfiliba
hey i've been seeing lots of config-file-readers for python. be it ConfigObj (http://www.voidspace.org.uk/python/configobj.html) or the like. seems like a trend to me. i came to this conclusion a long time ago: YOU DON'T NEED CONFIG FILES FOR PYTHON. why re-invent stuff and parse text by

Re: Numbers in python

2006-03-10 Thread Diez B. Roggisch
However, I can't seem to get the program to treat the numbers as numbers. If I put them in the dictionary as 'THE' = int(0.965) the program returns 1.0 It certainoly does _not_ return 1.0 - it returns 1. And that is all it can return for being an integer that has by definition no fractional

Re: File Permissions

2006-03-10 Thread Sybren Stuvel
Sebastjan Trepca enlightened us with: Those constants are in stat module so add import stat before the program. Yeah, but just opening the file is more Pythonic than first checking if it can be opened in the first place. Sybren -- The problem with the world is stupidity. Not saying there

Re: Numbers in python

2006-03-10 Thread Duncan Booth
wrote: If I put them in the dictionary as 'THE' = int(0.965) the program returns 1.0 and if I put 'THE' = float(0.965) it returns 0.9655549 or something similar. Neither of these are right! Your system seems to be really screwed. int(0.965) should be 0, and float(0.965) should be

Re: why use special config formats?

2006-03-10 Thread tomerfiliba
and just as i was writing, this was added to lang.python.announce: http://groups.google.com/group/comp.lang.python.announce/browse_thread/thread/7a6cbcd8070627a0/24a7b35599f65794#24a7b35599f65794 -tomer -- http://mail.python.org/mailman/listinfo/python-list

Re: Numbers in python

2006-03-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Basically, I have a code with is almost finished but I've having difficultly with the last stage of the process. I have a program that gets assigns different words with a different value via looking them up in a dictionary: eg if THE is in the writing, it assigns

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: Thanks guys! I had a feeling exceptions were nothing like in C languages (i.e. a pain to deal with). :) Since when does C have exceptions? (You're not confusing C with C++ or C#?) -- http://mail.python.org/mailman/listinfo/python-list

Re: is there any overheard with try/except statements?

2006-03-10 Thread Magnus Lycka
John Salerno wrote: One of the things I learned with C# is that it's always better to handle any errors that might occur within the codes itself (i.e. using if statements, etc. to catch potential out of range indexing) rather than use too many try/catch statements, because there is some

Re: A better RE?

2006-03-10 Thread Magnus Lycka
Schüle Daniel wrote: txt = 21MAR06 31APR06 1236 m = '(?:JAN|FEB|MAR|APR|MAI|JUN|JUL|AUG|SEP|OCT|NOV|DEZ)' # non capturing group (:?) p = re.compile(r(\d\d%s\d\d) (\d\d%s\d\d) (?=[1234567])(1?2?3?4?5?6?7?) % (m,m)) p.match(txt).group(1) '21MAR06' p.match(txt).group(2)

Re: A better RE?

2006-03-10 Thread Magnus Lycka
Fredrik Lundh wrote: Magnus Lycka wrote: r(\d\d[A-Z]{3}\d\d) (\d\d[A-Z]{3}\d\d) (?=[1234567])(1?2?3?4?5?6?7?) Thanks a lot. (I knew about {3} of course, I was in a hurry when I posted since I was close to missing my train...) -- http://mail.python.org/mailman/listinfo/python-list

Re: Numbers in python

2006-03-10 Thread brainy_muppet
'It certainoly does _not_ return 1.0 - it returns 1. And that is all it can return for being an integer that has by definition no fractional part. ' For goodness sake, it was a typo, I'm so sorry! -- http://mail.python.org/mailman/listinfo/python-list

Re: Numbers in python

2006-03-10 Thread Diez B. Roggisch
It certainoly does _not_ return 1.0 - it returns 1. And that is all it can return for being an integer that has by definition no fractional part. Duncan was right of course. It returns 0. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: why use special config formats?

2006-03-10 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: i came to this conclusion a long time ago: YOU DON'T NEED CONFIG FILES FOR PYTHON. why re-invent stuff and parse text by yourself, why the interpreter can do it for you? Because you generally don't want to give the configuration file writer full control

Re: Numbers in python

2006-03-10 Thread brainy_muppet
'It certainoly does _not_ return 1.0 - it returns 1. And that is all it can return for being an integer that has by definition no fractional part. ' For goodness sake, it was a typo, I'm so sorry! -- http://mail.python.org/mailman/listinfo/python-list

Re: import and shared global variables

2006-03-10 Thread Michael Brenner
Ah, thanks everybody! I had thought that, although the name was set to __main__, the module that was stored in sys.modules was m1 nevertheless, not a copy. Well, having to write import m1 inside m1.py seems a bit peculiar - it's probably nicer to keep the __main__ module free from stuff that

Performance impact of using decorators

2006-03-10 Thread vinjvinj
I'm building an application with cherrypy and have started using decorators quite extensively. A lot of my exposed functions look like: @expose @startTransactrionAndBuildPage @partOfTabUi(tabId) @convert(arg1=int, arg2=str) def do_main_page(self, arg1, arg2): some code I've become really

Re: Which GUI toolkit is THE best?

2006-03-10 Thread Sybren Stuvel
Thomas Guettler enlightened us with: The licence for QT is GPL, this means you cannot use it in commercial application. That is why I never looked at it. Ehmm... from their website: The Qt Commercial License is the correct license to use for the construction of proprietary, commercial

Re: is there any overheard with try/except statements?

2006-03-10 Thread John Salerno
Magnus Lycka wrote: John Salerno wrote: Thanks guys! I had a feeling exceptions were nothing like in C languages (i.e. a pain to deal with). :) Since when does C have exceptions? (You're not confusing C with C++ or C#?) I meant C-based languages, like C#. --

Re: Performance impact of using decorators

2006-03-10 Thread Alex Martelli
vinjvinj [EMAIL PROTECTED] wrote: I'm building an application with cherrypy and have started using decorators quite extensively. A lot of my exposed functions look like: @expose @startTransactrionAndBuildPage @partOfTabUi(tabId) @convert(arg1=int, arg2=str) def do_main_page(self, arg1,

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Antoon Pardon
Op 2006-03-10, Diez B. Roggisch schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Specifying the names of the keyword parameters costs you a little typing once, but saves everybody (including yourself) a lot of grief later when you're trying to figure out what the heck your code does 6 months

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Antoon Pardon
Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: In article [EMAIL PROTECTED], Antoon Pardon [EMAIL PROTECTED] wrote: Op 2006-03-10, Roy Smith schreef [EMAIL PROTECTED]: Dmitry Anikin [EMAIL PROTECTED] wrote: There are often situations when a function has independent parameters, all

Re: Numbers in python

2006-03-10 Thread neildunn
If your still worried by using floats for your values you may wish to look into the decimal module: http://docs.python.org/lib/module-decimal.html Example: from decimal import Decimal Decimal(2) + Decimal('1.47') Decimal(3.47) Regards, Neil --

operator creation?

2006-03-10 Thread Gerardo Herzig
Hi all. Ill try to explain mi situation: Lets say i have an DB object, who implements the querys to the database trough a method called DBObject.doQuery. On the other hand, i have 50 sql functions stored in the database. So i can call DBObject.doQuery('select * from my_sql_function()')...Ok, what

  1   2   3   >