ANN: oejskit 0.8.5 JavaScript in-browser testing and utility kit with py.test plugin

2009-07-14 Thread Samuele Pedroni
jskit contains infrastructure and in particular a py.test plugin to enable running unit tests for JavaScript code inside browsers. The plugin requires py.test 1.0 The approach also enables to write integration tests such that the JavaScript code is tested against server-side Python code mocked

Moovida Media Center 1.0.5 Release

2009-07-14 Thread Olivier Tilloy
Dear Python users, The Moovida team is happy to announce the release of Moovida Media Center 1.0.5, code-named Ode To My Family. Moovida, formerly known as Elisa, is a cross-platform and open-source Media Center written in Python. It uses GStreamer [1] for media playback and pigment [2] to

LAST CALL: OSCON booth volunteers

2009-07-14 Thread Aahz
Please subscribe to the OSCON mailing list at http://mail.python.org/mailman/listinfo/oscon if you would like to help out with the Python/PSF booth at OSCON next week (Weds 7/22 and Thurs 7/23). We'll be hashing out the schedule soon. You do *not* need to be a paid OSCON attendee, but please get

Re: python _binary_ code

2009-07-14 Thread Chris Rebert
On Mon, Jul 13, 2009 at 10:41 PM, sanju pssanu1...@gmail.com wrote: Hi  Can anyone give me solution to create a python binary file (bytecode) other than pyc file .So my source code be secure.. I am working on ubuntu 9.04 with python2.6.. I PyInstaller (http://www.pyinstaller.org/) will

Re: python _binary_ code

2009-07-14 Thread Christian Heimes
sanju ps schrieb: Hi Can anyone give me solution to create a python binary file (bytecode) other than pyc file .So my source code be secure.. I am working on ubuntu 9.04 with python2.6.. I It's impossible to secure your code if it runs on an untrusted computer. This is true for all

copy a file

2009-07-14 Thread amrita
Dear all, Can anyone tell me that suppose i want to copy few lines from one text file to another then how can i do that.Looking forward for soon reply. Amrita Kumari Research Fellow IISER Mohali Chandigarh INDIA -- http://mail.python.org/mailman/listinfo/python-list

Re: explode()

2009-07-14 Thread alex23
Fred Atkinson fatkin...@mishmash.com wrote:         I wish the Python site was as well written as the PHP site. On the PHP site, I can look up a command and they show not only the docs on that command but a list of all other commands associated with it.   Hey Fred, My problem is the complete

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Ben Finney
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: Isn't that risky though? Won't that potentially change the exception- handling behaviour of functions and classes he imports from other modules? No, any existing ‘except’ clause will be unaffected by re-binding ‘sys.excepthook’. As

Re: copy a file

2009-07-14 Thread Krishnakant
On Tue, 2009-07-14 at 12:27 +0530, amr...@iisermohali.ac.in wrote: Dear all, Can anyone tell me that suppose i want to copy few lines from one text file to another then how can i do that.Looking forward for soon reply. very simple. open one file and open the source file. seek till to the

Remote audio recording in a multiuser environment

2009-07-14 Thread nelson -
Hi all! I'm developing an application that will be used in a school. It will allow client connected over ssh to liste to a multimedia file on the server. The server componente will record the audio taken from a specified client microphone, or it would pair two client, allowing them to

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 13, 8:25 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 13 Jul 2009 17:49:23 -0700, Carl Banks wrote: On Jul 13, 12:31 pm, Piet van Oostrum p...@cs.uu.nl wrote: seldan24 selda...@gmail.com (s) wrote: s Hello, s I'm fairly new at Python so hopefully this

RE: list of all possible values

2009-07-14 Thread Andreas Tawn
David Gibb: For example: if my values are ['a', 'b', 'c'], then all possible lists of length 2 would be: aa, ab, ac, ba, bb, bc, ca, cb, cc. from itertools import product list(product(abc, repeat=2)) [('a', 'a'), ('a', 'b'), ('a', 'c'), ('b', 'a'), ('b', 'b'), ('b', 'c'), ('c', 'a'),

How to unbuffer Python's output

2009-07-14 Thread Lily Gao
Hi, All I am calling a python program in perl and use redirection, Like : `python x.py 1.log 21` When x.py crash, I get nothing from 1.log, and if I don’t use redirection, I can get useful log from the screen. How can I do to make x.py ‘s output un-buffered when redirection log to files ,just

Re: MySQLdb + SSH Tunnel

2009-07-14 Thread R C
Got it working. Thanks for your help 1) login to B 2) setup a tunnel in the shell machine-B ssh -L B_ip_address:B_port:C_ip_address:C_port u...@c_ip_address for example: machine-B has ip 1.1.1.1 machine-C has ip 2.2.2.2 then I would type: machine-B ssh -L

Re: MySQLdb + SSH Tunnel

2009-07-14 Thread Riley Crane
Got it working. Thanks for your help! 1) login to B 2) setup a tunnel in the shell machine-B ssh -L B_ip_address:B_port:C_ip_address:C_port u...@c_ip_address for example: machine-B has ip 1.1.1.1 machine-C has ip 2.2.2.2 then I would type: machine-B ssh -L

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Steven D'Aprano
On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote: Seriously, do you *ever* take more than 2 seconds to consider whether you might be missing something obvious before following up with these indignant knee-jerk responses? Obviously not. [...] Or would you rather let all unexpected

Re: Passing python list from C to python

2009-07-14 Thread hartley
I'm very new at wrapping Python/C, and I have run into some problems. I have one python module that provides me with a list (provideBuffer in provideBuff.py):  Py_Initialize();         pName = PyString_FromString(provideBuff);         pModule = PyImport_Import(pName);        

Re: How to unbuffer Python's output

2009-07-14 Thread Chris Rebert
2009/7/13 Lily Gao lily@autodesk.com: Hi, All I am calling a python program in perl and use redirection, Like : `python x.py 1.log 21` When x.py crash, I get nothing from 1.log, and if I don’t use redirection, I can get useful log from the screen. How can I do to make x.py ‘s 

'unable to execute cc: No such file or directory' with distutils on Solaris

2009-07-14 Thread Tim Edwards
Hi, I'm trying to compile http://sourceforge.net/projects/astlib/ 0.17.1 on a Solaris 10 SPARC system. This python module uses distutils.ccompiler. The problem seems to be that although I have gcc installed in /usr/sfw/bin/gcc it keeps trying to execute the command 'cc', which doesn't work: cc

copy a few lines

2009-07-14 Thread amrita
Dear all, I want to know if i want to copy one paragraph from one text file to another then what command i have to use in python.Looking forwaard for soon reply. Thanks, Amrita Kumari Research Fellow IISER Mohali Chandigarh INDIA -- http://mail.python.org/mailman/listinfo/python-list

Re: copy a few lines

2009-07-14 Thread Chris Rebert
On Tue, Jul 14, 2009 at 2:43 AM, amr...@iisermohali.ac.in wrote: Dear all, I want to know if i want to copy one paragraph from one text file to another then what command i have to use in python.Looking forwaard for soon reply. Please don't double-post. It wastes everyone's time, especially

Re: renice

2009-07-14 Thread JonPeirce
Note that with os.nice you can only *decrease* priority. For increasing priority you need to run; os.system(sudo renice -n %s %s % (new_nice, os.getpid())) or simply set the nice level when you run python in the first place (you do also need sudo for this): sudo nice -n -15 python myScript.py

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Florian Brucker
Douglas Alan wrote: Thank you. My question wasn't intended to be Python specific, though. I am just curious for purely academic reasons about whether there is such an algorithm. All the sources I've skimmed only seem to the answer the question via omission. Which is kind of strange, since it

Re: Passing python list from C to python

2009-07-14 Thread hartley
On Jul 13, 6:35 pm, John Machin sjmac...@lexicon.net wrote: On Jul 14, 1:47 am, hartley hartle...@gmail.com wrote: I'm very new at wrapping Python/C, and I have run into some problems. I have one python module that provides me with a list (provideBuffer in provideBuff.py):  

Re: DBI module deprecated at Python 2.5--what to use in its place?

2009-07-14 Thread dana
On Jul 10, 12:15 pm, M.-A. Lemburg m...@egenix.com wrote: If you're looking for a stable and maintained ODBC for Python, have a look at our mxODBC extension or mxODBC Connect package: http://www.egenix.com/products/python/mxODBC/http://www.egenix.com/products/python/mxODBCConnect/ I'm looking

Re: Tkinter / Entry widget problem

2009-07-14 Thread Peter Otten
Andras Szabo wrote: Hello. I searched the archives but couldn't find a solution to a problem related to the Entry widget in Tkinter. When creating a pop-up window in an app, which contains an Entry widget, I want this widget to contain some default string, to have all this default string

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Lawrence D'Oliveiro
In message 93f6a517-63d8-4c80- bf19-4614b7099...@m7g2000prd.googlegroups.com, Carl Banks wrote: Or would you rather let all unexpected exceptions print to standard error, which is often a black hole in non-interactive sitations? Since when? Cron, for example, collects standard error and mails

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Lawrence D'Oliveiro
In message d82cea0b-3327-4a27- b300-08975f7c0...@p28g2000vbn.googlegroups.com, seldan24 wrote: For this particular script, all exceptions are fatal and I would want them to be. I just wanted a way to catch them and log them prior to program termination. You don't need to. They will be

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-14 Thread Lawrence D'Oliveiro
In message pan.2009.07.14.03.45...@remove.this.cybersource.com.au, Steven D'Aprano wrote: Are we supposed to interpret that post as Dumb Insolence or just Dumb? Insolence indeed ... another wanker to plonk, I think. -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Piet van Oostrum
Douglas Alan darkwate...@gmail.com (DA) wrote: DA On Jul 13, 3:57 pm, a...@pythoncraft.com (Aahz) wrote: Still, unless your list is large (more than thousands of elements), that's the way you should go.  See the bisect module.  Thing is, the speed difference between C and Python means the

Re: Passing python list from C to python

2009-07-14 Thread John Machin
On Jul 14, 7:22 pm, hartley hartle...@gmail.com wrote: I'm very new at wrapping Python/C, and I have run into some problems. [snip]         pValue = PyObject_CallObject(pFunc,NULL); pValue is now a PyList - i've even verified this with: int a = PyList_Check(pValue);        

Python code for testing well parenthesized expression

2009-07-14 Thread candide
Hi, I'm trying to implement in Python a function testing if an expression is well parenthesized. For instance the expression zx4er(1(er(Yy)ol)ol)ik is correctly parenthesized but this one zx(4er(1(er(Yy)ol)ol)ik is not. My code follows at the end. If you have a better algorithm or a better

Re: explode()

2009-07-14 Thread Fred Atkinson
On Tue, 14 Jul 2009 05:41:40 GMT, Tim Harig user...@ilthio.net wrote: On 2009-07-14, Fred Atkinson fatkin...@mishmash.com wrote: The one thing I really dislike about Python over PHP is that Python can usually only appear in the cgi directory (unless other arragements are made with your

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Jeremy Sanders
candide wrote: I'm trying to implement in Python a function testing if an expression is well parenthesized. For instance the expression zx4er(1(er(Yy)ol)ol)ik is correctly parenthesized but this one zx(4er(1(er(Yy)ol)ol)ik is not. My code follows at the end. If you have a better

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Adrian Dziubek
Strings are immutable, so your method of slicing one letter at time will be building lots of them. That shouldn't hurt you here, but it will when you hit a bigger problem. In the i() there should be return op == 0 on the end. def well(expr): mapping = {'(':1, ')':-1} count = 0 for s in

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Diez B. Roggisch
Jeremy Sanders wrote: candide wrote: I'm trying to implement in Python a function testing if an expression is well parenthesized. For instance the expression zx4er(1(er(Yy)ol)ol)ik is correctly parenthesized but this one zx(4er(1(er(Yy)ol)ol)ik is not. My code follows at the end. If

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Adrian Dziubek
Don't you want to just test that the number of (s equals the number of )s or am I missing the point? I had this idea too, but there is additional requirement that any beginning must have greater or equal number of '(' than ')'. -- Adrian -- http://mail.python.org/mailman/listinfo/python-list

Re: explode()

2009-07-14 Thread Fred Atkinson
On Mon, 13 Jul 2009 23:54:11 -0700 (PDT), alex23 wuwe...@gmail.com wrote: Fred Atkinson fatkin...@mishmash.com wrote:         I wish the Python site was as well written as the PHP site. On the PHP site, I can look up a command and they show not only the docs on that command but a list of all

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Martin P. Hellwig
candide wrote: To add to your implementations; a readable version: +++file parantheses.py+++ Parentheses Module Test def parentheses_are_paired(input_string): Check if 'input_string' contains paired parentheses, if so return True. parenthesis_count = 0 parenthesis_open = '('

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Jeremy Sanders
Diez B. Roggisch wrote: Yep, you are: (((( is certainly not well parenthized. Thanks for that! -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code for testing well parenthesized expression

2009-07-14 Thread David Smith
Jeremy Sanders wrote: candide wrote: I'm trying to implement in Python a function testing if an expression is well parenthesized. For instance the expression zx4er(1(er(Yy)ol)ol)ik is correctly parenthesized but this one zx(4er(1(er(Yy)ol)ol)ik is not. My code follows at the end. If you

Re: Efficient binary search tree stored in a flat array?

2009-07-14 Thread Scott David Daniels
Piet van Oostrum wrote: Douglas Alan darkwate...@gmail.com (DA) wrote: DA On Jul 13, 3:57 pm, a...@pythoncraft.com (Aahz) wrote: Still, unless your list is large (more than thousands of elements), that's the way you should go. See the bisect module. Thing is, the speed difference between C

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Martin P. Hellwig
Martin P. Hellwig wrote: candide wrote: To add to your implementations; a readable version: +++file parantheses.py+++ Parentheses Module Test def parentheses_are_paired(input_string): Check if 'input_string' contains paired parentheses, if so return True. parenthesis_count = 0

Re: Python code for testing well parenthesized expression

2009-07-14 Thread John Machin
candide candide at free.invalid writes: # The obvious iterative version def i(s): op = 0 # op : open parenthesis for k in range(len(s)): op += (s[k] == '(') - (s[k] == ')') if op 0: break return op E: H c, w t P. F: A c, b à P. Suggested better code: def

Re: Python code for testing well parenthesized expression

2009-07-14 Thread John Machin
On Jul 14, 11:08 pm, David Smith d...@cornell.edu wrote: Jeremy Sanders wrote: candide wrote: I'm trying to implement in Python a function testing if an expression is well parenthesized. For instance the expression zx4er(1(er(Yy)ol)ol)ik is correctly parenthesized but this one

WHIFF 0.4 += repoze.who authentication + menus + calculator + docs.

2009-07-14 Thread Aaron Watters
WHIFF (WSGI HTTP Integrated Filesystem Frames) 0.4 released. The new WHIFF 0.4 release linked from http://whiff.sourceforge.net includes the following enhancements: Built in support for repoze.who based authentication (from http://static.repoze.org/whodocs/ ) + tutorial see:

Re: Python code for testing well parenthesized expression

2009-07-14 Thread John Machin
Adrian Dziubek adrian.dziubek at gmail.com writes: In the i() there should be return op == 0 on the end. Hard to tell. In the absence of any docs, we have to resort to divination on the function name :-P ... is i short for iterative or imbalanced? --

Re: PDF: finding a blank image

2009-07-14 Thread DrLeif
On Jul 13, 6:22 pm, Scott David Daniels scott.dani...@acm.org wrote: DrLeif wrote: I have about 6000 PDF files which have been produced using a scanner with more being produced each day.  The PDF files contain old paper records which have been taking up space.   The scanner is set to

Re: Infinite loops and synchronization

2009-07-14 Thread Aahz
In article mailman.3048.1247462046.8015.python-l...@python.org, Vincent Gulinao vincent.guli...@gmail.com wrote: lst = list() while True: if len(lst) == SOME_NUMBER: return lst Q2: operating on list from threads (mostly appends) must be safe, right (synchronization)?

Re: compilation problem of python on AIX 6.1

2009-07-14 Thread Aahz
In article 51c556a8-7277-474d-821f-190adf155...@f16g2000vbf.googlegroups.com, Amit amit.kumar.i...@gmail.com wrote: THen I decided to compile python 2.5.4 on my AIX box. I downloaded the python source code from www.python.org and tried to compile on my AIX both using gcc. case $MAKEFLAGS

one-time factory in python for an experienced java guy

2009-07-14 Thread phonky
Hi I have searched all over and haven't found the solution for my problem yet. I am new to python, and all the time realize I do program python in java, which is not great. Besides being a real-life problem, I want to solve it as elegant as I can, using it to also learn about python (I know I

Re: PDF: finding a blank image

2009-07-14 Thread DrLeif
On Jul 13, 6:22 pm, Scott David Daniels scott.dani...@acm.org wrote: DrLeif wrote: I have about 6000 PDF files which have been produced using a scanner with more being produced each day.  The PDF files contain old paper records which have been taking up space.   The scanner is set to

Re: Tkinter / Entry widget problem

2009-07-14 Thread John Posner
Andras Szabo wrote: Hello. I searched the archives but couldn't find a solution to a problem related to the Entry widget in Tkinter. When creating a pop-up window in an app, which contains an Entry widget, I want this widget to contain some default string, to have all this default string

Re: explode()

2009-07-14 Thread Piet van Oostrum
Fred Atkinson fatkin...@mishmash.com (FA) wrote: FA On Tue, 14 Jul 2009 05:41:40 GMT, Tim Harig user...@ilthio.net FA wrote: On 2009-07-14, Fred Atkinson fatkin...@mishmash.com wrote: The one thing I really dislike about Python over PHP is that Python can usually only appear in the cgi

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Stefan Behnel
phonky wrote: class Account(object): def __init__(self, holder): self.__accountnumber = self.__generate_account_number() Now, I do not know yet how the account number scheme looks like. For now, I just want to have an incremental number; later, when going to production,

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Paul Rubin
Stefan Behnel stefan...@behnel.de writes: phonky wrote: class Account(object): def __init__(self, holder): self.__accountnumber = self.__generate_account_number() Now, I do not know yet how the account number scheme looks like. For now, I just want to have an

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread phonky
Stefan, thanks first of all Use a global variable in the module. I have an account_number_generator variable in the module, I got that hint from searching the web. But where my stubborn java mind doesn't release me: what does the variable contain? Do I create the actual IncrementalGenerator

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Paul Rubin
phonky pho...@europe.com writes: But where my stubborn java mind doesn't release me: what does the variable contain? Do I create the actual IncrementalGenerator object there? Or the super class? Or just a string, which a factory method takes to create the actual object? Ugh, just forget

Why does extend() fail in this case, and what am I doing wrong?

2009-07-14 Thread Xavier Ho
Why doesn't the second output print [1, 2, 3, , 7, 8, 9] ? The code is run at: http://codepad.org/wgLU4JZh class A(): def __init__(self): self.n = [1, 2, 3, 4, 5] a = A() print a.n print a.n.extend([6, 7, 8, 9]) #Output: #[1, 2, 3, 4, 5] #None I really don't know, but I'm

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread phonky
Thanks Paul, Ugh, just forget everything you ever knew about java. Do some Zen exercises to erase your mind. Then read a Python tutorial as if you're starting from nothing. Yeah, surely right, but easier said than done... I'm working on it. Taking your example. import itertools class

Re: Why does extend() fail in this case, and what am I doing wrong?

2009-07-14 Thread Pablo Torres N.
This has been asked extensively before, here and elsewhere. On Tue, Jul 14, 2009 at 09:52, Xavier Hocont...@xavierho.com wrote: Why doesn't the second output print [1, 2, 3, , 7, 8, 9] ? The code is run at: http://codepad.org/wgLU4JZh class A():     def __init__(self):     self.n =

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Mahmoud Abdelkader
What Paul was trying to elaborate on is that have your customers or whomever will use this implement their own generator protocol to generate whatever number format they need. Paul just gave you an example with itertools.count(), where it is an infinite generator that yields count+1 every time.

Re: Why does extend() fail in this case, and what am I doing wrong?

2009-07-14 Thread MRAB
Xavier Ho wrote: Why doesn't the second output print [1, 2, 3, , 7, 8, 9] ? The code is run at: http://codepad.org/wgLU4JZh class A(): def __init__(self): self.n = [1, 2, 3, 4, 5] a = A() print a.n print a.n.extend([6, 7, 8, 9]) #Output: #[1, 2, 3, 4, 5] #None I

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Paul Rubin
phonky pho...@europe.com writes: itertools.count(): Make an iterator that returns consecutive integers starting with n to me that sounds like that solves the increment issue, but what about future modules wanting to plug in a different numbering format, e.g. 205434.1234 or whatever? You'd

Re: Why does extend() fail in this case, and what am I doing wrong?

2009-07-14 Thread Jochen Schulz
Xavier Ho: Why doesn't the second output print [1, 2, 3, , 7, 8, 9] ? -- snip print a.n.extend([6, 7, 8, 9]) extend doesn't fail. It just returns None and extends the list in place. In [1]: l = [1, 2, 3] In [2]: l.extend([4, 5, 6]) In [3]: l Out[3]: [1, 2, 3, 4, 5, 6] J. -- When I

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Peter Otten
phonky wrote: Thanks Paul, Ugh, just forget everything you ever knew about java. Do some Zen exercises to erase your mind. Then read a Python tutorial as if you're starting from nothing. Yeah, surely right, but easier said than done... I'm working on it. Taking your example.

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread Aahz
In article 23406$4a5c9c7d$d9a2f023$27...@news.hispeed.ch, phonky pho...@europe.com wrote: import itertools class Account(object): def __init__(self, holder, gen=itertools.count()): self.__accountnumber = gen.next() If you consider my python illiteracy,

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread pdpi
On Jul 14, 3:03 pm, phonky pho...@europe.com wrote: Hi I have searched all over and haven't found the solution for my problem yet. I am new to python, and all the time realize I do program python in java, which is not great. Besides being a real-life problem, I want to solve it as elegant

Re: Proposal: Decimal literals in Python.

2009-07-14 Thread Scott David Daniels
Tim Roberts wrote: My favorite notation for this comes from Ada, which allows arbitrary bases from 2 to 16, and allows for underscores within numeric literals: x23_bin : constant := 2#0001_0111#; x23_oct : constant := 8#27#; x23_dec : constant := 10#23#; x23_hex : constant := 16#17#;

Re: Why does extend() fail in this case, and what am I doing wrong?

2009-07-14 Thread Xavier Ho
I see. Thanks! Ching-Yun Xavier Ho, Technical Artist Contact Information Mobile: (+61) 04 3335 4748 Skype ID: SpaXe85 Email: cont...@xavierho.com Website: http://xavierho.com/ On Tue, Jul 14, 2009 at 11:20 PM, Jochen Schulz m...@well-adjusted.de wrote: Xavier Ho: Why doesn't the second

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 14, 2:14 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote: Seriously, do you *ever* take more than 2 seconds to consider whether you might be missing something obvious before following up with these indignant

Re: Proposal: Decimal literals in Python.

2009-07-14 Thread MRAB
Scott David Daniels wrote: Tim Roberts wrote: My favorite notation for this comes from Ada, which allows arbitrary bases from 2 to 16, and allows for underscores within numeric literals: x23_bin : constant := 2#0001_0111#; x23_oct : constant := 8#27#; x23_dec : constant := 10#23#;

why did you choose the programming language(s)you currently use?

2009-07-14 Thread Deep_Feelings
So you have chosen programming language x so shall you tell us why you did so , and what negatives or positives it has ? -- http://mail.python.org/mailman/listinfo/python-list

Re: The meaning of =

2009-07-14 Thread Aahz
In article m24otg3hkk@cs.uu.nl, Piet van Oostrum p...@cs.uu.nl wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand (LD) wrote: LD In message h3bogf$oo...@panix3.panix.com, Aahz wrote: Aahz class AttrDict: Aahz def __getitem__(self, key): Aahz return getattr(self, key)

how to determine if python is run interactively? (-i)

2009-07-14 Thread jfrancis4970
how do you determine, from within a python program, whether the python interpreter was launched in interactive mode? in other words, if i have a program called test.py, i want to ensure that the program was launched with this command line: python -i test.py (and not just with python test.py).

Re: Tkinter / Entry widget problem

2009-07-14 Thread Andras Szabo
So it's either that I use Python 2.5.1, or that I use it on a Mac. (John, your code still doesn't work the way it's supposed to here.) I guess I'll upgrade to 2.6.1 and see if it makes a difference. (The Tkinter/Tcl versions are the same for me.) Thanks for your help. andras On Jul 14,

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 14, 4:48 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 93f6a517-63d8-4c80- bf19-4614b7099...@m7g2000prd.googlegroups.com, Carl Banks wrote: Or would you rather let all unexpected exceptions print to standard error, which is often a black hole in

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread MRAB
Deep_Feelings wrote: So you have chosen programming language x so shall you tell us why you did so , and what negatives or positives it has ? I've heard of C and D, but not x, unless you mean XPL (X Programming Language) or PLAN-X. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to set timeout while colling a soap method?

2009-07-14 Thread ryles
On Jul 13, 9:07 am, dzizes dzizes...@gmail.com wrote: Hello! I wrote some some python code for executing a soap method: import SOAPpy from SOAPpy import WSDL _server = WSDL.Proxy(some wsdl) r=_server.generuj(some parameters...) print r.encode('cp1250') It works fine. However, the

Re: how to determine if python is run interactively? (-i)

2009-07-14 Thread Duncan Booth
jfrancis4...@mailinator.com wrote: how do you determine, from within a python program, whether the python interpreter was launched in interactive mode? sys.flags.interactive or sys.flags.inspect -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Duncan Booth
John Machin sjmac...@lexicon.net wrote: Try an iterative version of checking that () [] and {} are balanced and nested appropriately. Here's how I might approach the more general case: def balanced(s, parens=((),)): ''' Example: balanced('aAAA(b[bb(c]c))') True

select lines in python

2009-07-14 Thread amrita
Dear all, Can anyone tell me that suppose i have a file having content like: _Atom_name _Atom_type _Chem_shift_value _Chem_shift_value_error _Chem_shift_ambiguity_code 1 1 PHE H H 8.49 0.02 1 2 1 PHE HAH 4.60

Re: select lines in python

2009-07-14 Thread David Gibb
try something like: for line in open(filename).readlines(): if (re.search(PHE|ASP,line): print line On Tue, Jul 14, 2009 at 1:33 PM, amr...@iisermohali.ac.in wrote: Dear all, Can anyone tell me that suppose i have a file having content like:    _Atom_name      _Atom_type      

Re: one-time factory in python for an experienced java guy

2009-07-14 Thread phonky
Thanks for all replies. I need to practice much more pythonese In fact I don't think to understand all of your suggestions, so I'll need to go through them and decide what approach I am going to take. Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Mensanator
On Jul 14, 10:55 am, Deep_Feelings doctore...@gmail.com wrote: So you have chosen programming language x so shall you tell us why you did so , and  what negatives or positives it has ? language must have - unlimited precision integers - easy to program - IDE not required - reasonable speed -

ImportError: No module named _functools

2009-07-14 Thread Tony Lay
I'm sooo close to getting this meld program runninghad to install a lot of things in /usr/local to get to pygtk2 functional and I'm trying to run the meld program and get... RHEL4 server Traceback (most recent call last): File /usr/local/bin/meld, line 35, in module import gettext

Re: Why not enforce four space indentations in version 3.x?

2009-07-14 Thread John Nagle
walterbyrd wrote: I believe Guido himself has said that all indentions should be four spaces - no tabs. Since backward compatibility is being thrown away anyway, why not enforce the four space rule? At least that way, when I get python code from somebody else, I would know what I am looking

Re: select lines in python

2009-07-14 Thread David Gibb
I think what Grant is saying is that you should read the documentation for the re module. David On Tue, Jul 14, 2009 at 3:12 PM, Grant Edwardsinva...@invalid wrote: On 2009-07-14, amr...@iisermohali.ac.in amr...@iisermohali.ac.in wrote: Can i become more precise like instead of printing all

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread Mark Dickinson
On Jul 14, 8:20 pm, ~km knny.m...@gmail.com wrote: I'm experiencing a strange behaviour of the Python prompt when using the four arrow keys ( not the VIM' nor Emacs' ones ;-) ). Instead of getting the previous and next command respectively I get ugly characters. See it

Re: missing 'xor' Boolean operator

2009-07-14 Thread Chris Rebert
On Tue, Jul 14, 2009 at 11:47 AM, Mark Dickinsondicki...@gmail.com wrote: On Jul 14, 7:25 pm, Dr. Phillip M. Feldman pfeld...@verizon.net wrote: Current Boolean operators are 'and', 'or', and 'not'.  It would be nice to have an 'xor' operator as well. Hmm.  I don't think 'nice' is

Re: http://tinypic.com/view.php?pic=m78cgps=3

2009-07-14 Thread Chris Rebert
On Tue, Jul 14, 2009 at 12:15 PM, ~kmknny.m...@gmail.com wrote: Hi, I'm experiencing a strange behaviour of the Python prompt when using the four arrow keys ( not the VIM' nor Emacs' ones ;-) ). Instead of getting the previous and next command respectively I get ugly characters. See it

Re: missing 'xor' Boolean operator

2009-07-14 Thread Ethan Furman
Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major selling points of Python). But, this is

Re: How to check if any item from a list of strings is in a big string?

2009-07-14 Thread Nobody
On Tue, 14 Jul 2009 02:06:04 -0300, Gabriel Genellina wrote: Matt, how many words are you looking for, in how long a string ? Were you able to time any( substr in long_string ) against re.compile ( |.join( list_items )) ? There is a known algorithm to solve specifically this problem

decorators - would be nice if...

2009-07-14 Thread Ken Seehart
Almost every time I use decorators, I find myself wishing I had access to the local namespace of the context from which the decorator is executed. In practice, decorator is being applied to a method, so the namespace in question would be the dictionary of the class being created. Similarly,

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread ~km
On 14 Jul., 15:26, Mark Dickinson dicki...@gmail.com wrote: Where did your version of Python 2.6 come from? If you built your copy of Python 2.6 from source, then the problem is probably that either the readline library is missing, or (much more likely) the include files for the readline

Re: bad behaviour in interactive Python prompt

2009-07-14 Thread ~km
On 14 Jul., 15:26, Mark Dickinson dicki...@gmail.com wrote: Where did your version of Python 2.6 come from? If you built your copy of Python 2.6 from source, then the problem is probably that either the readline library is missing, or (much more likely) the include files for the readline

Re: missing 'xor' Boolean operator

2009-07-14 Thread MRAB
Ethan Furman wrote: Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major selling points of

Re: why did you choose the programming language(s)you currently use?

2009-07-14 Thread Nobody
On Tue, 14 Jul 2009 11:47:08 -0700, Paul Rubin wrote: - unlimited precision integers - easy to program - IDE not required - reasonable speed - math library needs to include number theoretic functions like GCD, LCM, Modular Inverse, etc. - not fucking retarded like F# Have you looked

Re: decorators - would be nice if...

2009-07-14 Thread Diez B. Roggisch
Ken Seehart schrieb: Almost every time I use decorators, I find myself wishing I had access to the local namespace of the context from which the decorator is executed. In practice, decorator is being applied to a method, so the namespace in question would be the dictionary of the class being

Re: missing 'xor' Boolean operator

2009-07-14 Thread Ethan Furman
MRAB wrote: Ethan Furman wrote: Robert Kern wrote: On 2009-07-14 14:56, Dr. Phillip M. Feldman wrote: != does do what I want, except that it doesn't indicate to someone reading the code that the operands are being treated as logicals. (Readability is supposed to be one of the major

  1   2   >