Re: Tkinter

2009-02-04 Thread Francesco Bochicchio
Luke ha scritto: Hello, I'm an inexperienced programmer and I'm trying to make a Tkinter window and have so far been unsuccessful in being able to delete widgets from the main window and then add new ones back into the window without closing the main window. The coding looks similar to this: .

Re: python contextmanagers and ruby blocks

2009-02-21 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 00:46:08 -0800, Alia Khouri wrote: > As an exercise, I recently translated one of my python scripts (http:// > code.activestate.com/recipes/576643/) to haskell (a penultimate > version exists at > http://groups.google.com/group/comp.lang.haskell/browse_thread/thread/fb1ebd986b

Re: python contextmanagers and ruby blocks

2009-02-22 Thread Francesco Bochicchio
On Sat, 21 Feb 2009 09:42:02 -0800, Aahz wrote: > In article , > Alia K wrote: >> >>Nevertheless, I remain curious about whether once can use the >>contextmanager in python to achieve the full power of ruby's blocks... > > Short answer: no > > Longer answer: the way in Python to achieve the fu

Re: Emacs vs. Eclipse vs. Vim

2008-11-30 Thread Francesco Bochicchio
On Sat, 29 Nov 2008 12:44:14 -0800, Josh wrote: > If you were a beginning programmer and willing to make an investment in > steep learning curve for best returns down the road, which would you pick? > Honestly, I would invest my time and energy in someting more significant than editor skills. I

Re: Python's popularity

2008-12-22 Thread Francesco Guerrieri
h it, why in the world should a Python programmer consider her an "enemy"??? Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: select.select and socket.setblocking

2008-12-30 Thread Francesco Bochicchio
Laszlo Nagy ha scritto: I'm using this method to read from a socket: def read_data(self,size): """Read data from connection until a given size.""" res = "" fd = self.socket.fileno() while not self.stop_requested.isSet(): remaining = size - len(res)

Re: MemoryError when list append... plz help

2008-12-31 Thread Francesco Bochicchio
[BON] ha scritto: == s=[] for i in range(11000-1): for j in range(i+1, 11000): s.append(((i,j),sim)) == above sim is floating type. s.append is totally coducted 60,494,500 times. but this code raise MemoryError. My computer has

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Grant Edwards ha scritto: On 2008-12-30, Francesco Bochicchio wrote: 3. AFAIK (sorry, I feel acronym-ly today ;), there is no difference in select between blocking and non-blocking mode. The difference is in the recv (again, assuming that you use TCP as protocol, that is AF_INET, SOCK_STREAM

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Jean-Paul Calderone ha scritto: On Tue, 30 Dec 2008 19:19:08 +0100, Francesco Bochicchio wrote: [snip] If you are interested in socket errors, you should also fill the third 'fd-set' in the select call, and after select returns check that fd is not in it anymore: ready = select.s

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Francesco Bochicchio ha scritto: No, in blocking mode it will wait to receive _some_ data (1 or more bytes). The "requested" amount is strictly an upper limit: recv won't return more than the requested number of bytes, but it might return less. Uhm. In my experience, with TC

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
< ... > Uhm. In my experience, with TCP protocol recv only returned less than the required bytes if the remote end disconnects. I always check the What if the sending end actually sent less than you asked for ? -srp In blocking mode and with TCP protocol, the recv waits until more bytes a

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Saju Pillai ha scritto: On Dec 31, 7:48 pm, Francesco Bochicchio wrote: Is this correct ? IIRC even in blocking mode recv() can return with less bytes than requested, unless the MSG_WAITALL flag is supplied. Blocking mode only guarantees that recv() will wait for a message if none is available

Re: select.select and socket.setblocking

2009-01-01 Thread Francesco Bochicchio
Can you post an example program that exhibits the behavior you describe? I was forgetting about the MSG_WAITALL flag ... When I started programming with sockets, it was on a platform (IIRC Solaris) that by default behaved like MSG_WAITALL was set by default (actually, I don't remember it be

Re: yacc statement recognition [PLY]

2009-01-02 Thread Francesco Bochicchio
Slafs ha scritto: Hi ALL! I have to write in yacc an acceptor of files with lines matching this regexp: '[0-9],[0-9]' and I don't know what I am doing wrong beacuse this: tokens = ( 'NUMBER', ) literals = [','] t_NUMBER = r'\d' ... def p_statement_exp(p): '''statement :

Re: Is there a better algorithm?

2009-01-02 Thread Francesco Bochicchio
Kottiyath ha scritto: I have the following list of tuples: L = [(1, 2), (3, 4, 5), (6, 7)] I want to loop through the list and extract the values. The only algorithm I could think of is: for i in l: ... u = None ... try: ... (k, v) = i ... except ValueError: ... (k, u, v) = i ... print

Re: Reverse order of bit in repeating seqence of byte string

2009-01-02 Thread Francesco Bochicchio
imageguy ha scritto: I am looking for the most efficient method of replacing a repeating sequence in a byte string returned from a imaging .dll, connected via I receive the byte string with the following sequence 'bgrbgrbgrbgr' and I would like to convert this to 'rbgrbgrbgrbg' FWIW, the string

Re: Using PythonPath under Windows Vista.

2009-01-04 Thread Francesco Bochicchio
On Sun, 04 Jan 2009 04:56:51 -0800, Morgul Banner Bearer wrote: > Hi Everybody, > ... > > > The behaviour of the program is as follows : > In a Dos Box, the program executes nicely when i type : > "c\python26>python c:\python26\work\brian.py". > > Now i understand that- because I set the Pytho

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Francesco Bochicchio
Il Sun, 19 Oct 2008 10:34:23 +0200, Stef Mientki ha scritto: ... I'm very > satisfied with Python, and must say it's much more beautiful language > than Delphi, seen over the full width of programming. Although both > languages are Object Oriented, for some (unknown) reason it's 10 times > easi

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-12 Thread Francesco Guerrieri
On Wed, Nov 12, 2008 at 2:01 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Now, can we get on to something substantive like how many angels can > dance on the head of a pin? > Oh, come on, that's too easy! 42. I thought that by now everybody knew that. Francesco -- http://mai

Re: Python-URL! - weekly Python news and links (Nov 17)

2008-11-17 Thread Francesco Guerrieri
's just me but I find that on average Python documentation on the web is pretty good (*) and does its job very well. One is also left to wonder why all these critics don't take some initiative and work to improve it. Francesco (*) Not to mention many books, papers, and magazines, like tho

Re: objectoriented -?- functional

2009-03-18 Thread Francesco Guerrieri
ould be doing what you expected: def reverse_(a_list): """list.reverse() returns None; reverse_ returns the reversed list""" a_list = a_list[:] # copy the list - try omitting this line and you will get your previous behaviour a_list.reverse() # reverse the cop

Re: [ANN] lxml 2.2 released

2009-03-22 Thread Francesco Guerrieri
news! I have relied on lxml in many occasions and it has always been excellent :-) Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter questions: behavior of StringVar, etc

2009-03-29 Thread Francesco Bochicchio
Alan G Isaac ha scritto: On Mar 28, 2:15 pm, Alan G Isaac wrote: I'm a complete newbie to GUI. I have a couple questions about tkinter. 1. Where is the list of changes in Python 3's tkinter? 2. What exactly is the role of the root object, traditionally created as ``root=tk.Tk()``?

Re: Testing dynamic languages

2009-04-04 Thread Francesco Bochicchio
On Sat, 04 Apr 2009 07:37:44 -0700, grkuntzmd wrote: > I am a Java developer. There, I said it :-). > > When I am writing code, I can rely on the compiler to confirm that > any methods I write will be called with parameters of the "right" > type. I do not need to test that parameter #1 really is

Re: Killing threads

2009-04-05 Thread Francesco Bochicchio
On Sat, 04 Apr 2009 22:45:23 -0700, ericwoodworth wrote: > On Apr 5, 12:22 am, a...@pythoncraft.com (Aahz) wrote: >> In article >> <4b52f7d7-81d5-4141-9385-ee8cfb90a...@l1g2000yqk.googlegroups.com>, >> >>   wrote: >> >> >I'm using queues to talk between these threads so I could certainly >> >put

Re: Python 2.6/3.0 packages for Ubuntu?

2009-04-11 Thread Francesco Bochicchio
s...@pobox.com ha scritto: Does Ubuntu really not have Python 2.6 or 3.0 packages or do I just have my package list misconfigured? I'm setting up a fresh machine and am not too Ubuntu-aware. Is there a list of package repositories around somewhere? Thx, In current 8.10, the default python is

Re: Reading 3 objects at a time from list

2009-04-11 Thread Francesco Bochicchio
Chris Rebert ha scritto: On Sat, Apr 11, 2009 at 1:44 AM, Matteo wrote: Hi all, let's see if there is a more "pythonic" way of doing what I'm trying to do. I have a lot of strings with numbers like this one: string = "-1 1.3 100.136 1 2.6 100.726 1 3.9 101.464 -1 5.2 102.105" I need to pass t

Re: Definition of Pythonic?

2009-04-13 Thread Francesco Bochicchio
John Yeung ha scritto: On Apr 11, 10:08 am, Emmanuel Surleau wrote: Having written a few trivial scripts in Python, I'm curious as to how you would sum up the Pythonic philosophy of development. A couple of others have already mentioned the Zen of Python, available at the Python command promp

value error

2009-04-23 Thread Francesco Pietra
hi: with script data = open('134-176_rectified_edited.pdb', 'r') outp = open('134-176_renumbered.pdb', 'w') for L in data: if L[3] == 'M': L = L[:24] + "%4d" % (int(L[24-28])+133) + L[28:] outp.write(L) i wanted to modify lines of the type: ATOM 1 HH31 ACE 1 1.573 1.

Re: Thread-killing, round 666 (was Re: Lisp mentality vs. Python mentality)

2009-04-27 Thread Francesco Guerrieri
ed a language. What cannot be added to it in an elegant way, consistent with the overall picture, is better kept out of the language. It's not a matter of attitude or understanding... Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: find sublist inside list

2009-05-04 Thread Francesco Guerrieri
x27;, 'g', 'a', 'c'] > for i in range(len(li)): >if li[i:i + 2] == ['a', 'c']: >li[i:i + 2] = ['6'] > > HTH, > > John > Beware that you are mutating the list you are iterating over. That could lead to some strange bugs (for instance if you replaced the deleted items with a longer sequence, the range(len(li)) would still go up to the original lenght). It is better to modify a new list instead. Eg you could append to a new list. Francesco -- http://mail.python.org/mailman/listinfo/python-list

strip part of string

2009-05-10 Thread Francesco Pietra
70 44.395 without any blank space to the right. . Everything else should remain at its original column. I have been looking for statement, unable (my big fault ) to find a right one. I tried with slices % but it becomes unnecessarily complex. Thanks francesco # Sample line # 1 2

problems with PyML: ImportError: No module named _ckernel

2009-05-19 Thread Francesco Stablum
happens. Actually, there is a report for this bug: http://sourceforge.net/forum/forum.php?thread_id=2167098&forum_id=393034 but nobody answered. any ideas? thanks in advance, Francesco Stablum -- The generation of random numbers is too important to be left to chance - Robert R. Coveyou -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib returns EOFError

2008-05-19 Thread Francesco Bochicchio
On Mon, 19 May 2008 13:27:23 +0100, Jon Bowlas wrote: > Hi All, > > I've written a little method to connect to an ftpserver which works well, > however when I send a file using this ftp connection oddly I _sometimes_ get > returned an EOFError from ftplib.getline even though my file is actually >

Re: finding icons for Apps

2008-05-25 Thread Francesco Bochicchio
On Sat, 24 May 2008 21:42:57 -0700, Sanoski wrote: > This might be a dumb question. I don't know. I'm new to all this. How > do you find icons for your programs? All GUI applications have cool > icons that represent various things. For instance, to save is often > represented as a disk, etc. You k

Re: Overloading virtual method of widget without inheriting (PyQt)

2008-05-27 Thread Francesco Bochicchio
On Tue, 27 May 2008 01:31:35 -0700, Alex Gusarov wrote: > Hello, I have strong .NET background with C# and want to do some > familiar things from it with Python, but don't know how. For example, > I created form in qt designer with QCalendarWidget, translated it into > Python module and want to ov

Re: Python Threads - stopped vs. gone vs. Alive

2008-05-28 Thread Francesco Bochicchio
On Wed, 28 May 2008 11:38:53 -0700, RossGK wrote: > > I've answered my own question about the "None" state - an event was > setting the thread to None where I didn't expect it. > > However, my question slightly repositioned is if a Thread is "Stopped" > it still seems to exist. Is there someway

Re: Strange problem ....

2008-07-23 Thread Francesco Bochicchio
Il Wed, 23 Jul 2008 01:19:48 -0700, karthikbalaguru ha scritto: > Hi, > > I am new to python, Kindly suggest to resolve a problem with a python > file. > What does the below error refer to ? > I use Redhat 9.0, python-2.2.2-26, python-devel-2.2.2-26 and > db4-4.0.14-20. > > [EMAIL PROTECTED] pro

Insert character at a fixed position of lines

2008-07-26 Thread Francesco Pietra
How to insert letter "A" on each line (of a very long list of lines) at position 22, i.e., one space after "LEU", leaving all other characters at the same position as in the original example: ATOM 1 N LEU 1 146.615 40.494 103.776 1.00 73.04 1SG 2 In all lines"ATOM" is c

Re: Insert character at a fixed position of lines

2008-07-26 Thread Francesco Pietra
scripts I am lost about the filename for the pdb file to modify, francesco On Sat, Jul 26, 2008 at 11:35 AM, Lie <[EMAIL PROTECTED]> wrote: > On Jul 26, 2:41 pm, "Francesco Pietra" <[EMAIL PROTECTED]> wrote: >> How to insert letter "A" on each line (of a ver

Re: Insert character at a fixed position of lines

2008-07-26 Thread Francesco Pietra
File xxx.pdb is opened by the command: when I forgot the single quote ' after [23:] the error answer was: SynthaxError: EOL while scanning single-quoted string. Thanks francesco On Sat, Jul 26, 2008 at 1:10 PM, Lie <[EMAIL PROTECTED]> wrote: > On Jul 26, 5:42 pm, "Francesco Pietra

Insert string into string

2008-07-26 Thread Francesco Pietra
ng positions 7-11, right justified (Thus 1, as in the line example above, means first line). A second, similar file yyy.pdb has to be concatenated to xxx.pdb. Before that it should be added of "A" as above and renumbered at position 7-11, starting from 428 (there is an intermediate line to add). How should a script look like for this string insertion into string with recursive +1? Thanks francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: who said python can't be obsfucated!?

2008-04-02 Thread Francesco Bochicchio
On Wed, 02 Apr 2008 07:19:08 -0700, cokofreedom wrote: > def s(c):return[]if c==[]else s([_ for _ in c[1:]if _ +s([_ for _ in c[1:]if _>=c[0]]) > > Anyone else got some wonders...? Not so good: it took me only one minute to anderstand that is a recursive sort ... or it is? I read it as: """ th

Re: TKinter, buttonwidget response problem(1) and all btns the same size(2)!

2008-04-05 Thread Francesco Bochicchio
Il Fri, 04 Apr 2008 20:26:13 -0700, 7stud ha scritto: > On Apr 4, 7:06 pm, [EMAIL PROTECTED] wrote: >> 1st question: >> >> when i run this program 1 will be printed into the interpreter when i >> run it BUT without me clicking the actual button. when i then click the >> button "1", nothing happens

Re: problem with listdir

2008-04-26 Thread Francesco Bochicchio
On Sat, 26 Apr 2008 01:24:23 -0700, jimgardener wrote: > hi > i have a directory containing .pgm files of P5 type.i wanted to read > the pixel values of these files ,so as a firststep i wrote code to > make a list of filenames using listdir > > pgmdir="f:\code\python\pgmgallery" # where i have

Re: display monochromatic images wxPython

2008-04-26 Thread Francesco Bochicchio
On Fri, 25 Apr 2008 14:42:17 -0700, [EMAIL PROTECTED] wrote: > Dear All, > I want to write a GUI program with wxPython displaying an image. But > the image I have is monochromatic. When I retrieve the data from the > image I end up with a list of integer. Starting from a list of integer > and know

Re: Determine socket family at runtime

2008-05-04 Thread Francesco Bochicchio
On Sun, 04 May 2008 08:49:55 -0700, Giampaolo Rodola' wrote: > Hi there, > since the socket.socket.family attribute has been introduced only in > Python 2.5 and I need to have my application to be backward compatible > with Python 2.3 and 2.4 I'd like to know how could I determine the > family of

Re: config files in python

2008-05-05 Thread Francesco Bochicchio
On Mon, 05 May 2008 00:35:51 -0700, sandipm wrote: > Hi, > In my application, I have some configurable information which is used > by different processes. currently I have stored configration in a > conf.py file as name=value pairs, and I am importing conf.py file to > use this variable. it works

Re: Initializing a subclass with a super object?

2008-05-11 Thread Francesco Bochicchio
On Sat, 10 May 2008 18:09:02 -0700, frankdmartinez wrote: > Hi, Terry. > Yeah, no. If we think of the inherited B as an object nested > within a1, I'm attempting to initialize that B with b1 by accessing > the B, say, via a function call. I don't see how using a python > factory achieves thi

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread Francesco Bochicchio
On 28 Ago, 08:09, inorlando <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about python and sockets , UDP datagram in > particular. I'm new to socket programming so please bare with me. > > I am trying to write a simple application that broadcast files to > another computer on the same

Re: translating "create Semaphore" to Linux

2008-08-29 Thread Francesco Bochicchio
On 29 Ago, 13:28, GHUM <[EMAIL PROTECTED]> wrote: > hello, > > in my application I am using > > hSem = win32event.CreateSemaphore (None, 1, > 1,"stringincludinginterfaceandport") > rt=win32event.WaitForSingleObject (hSem, 0) > if rt != win32event.WAIT_TIMEOUT: >    really_do_start_my_app() > else:

Renumbering

2008-09-02 Thread Francesco Pietra
different for the same name in column 4. For example, LEU can have a different number of lines depending on the position of this amino acid (leucine). I was unable to set non-proportional characters, sorry. Thanks for help francesco pietra -- http://mail.python.org/mailman/listinfo/python-list

Re: path slashes cleaning

2008-09-04 Thread Francesco Guerrieri
] == '/': > a = list(a) > a.pop() > ''.join(a) > > Thanks, > Mathieu a.rstrip('/') does the job. bye, Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows / Tkinter - problem with grid - not able to place widgets at desired places

2008-09-14 Thread Francesco Bochicchio
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: >>Hi, >> >>I'm learning Python and Tkinter. I've started programming in Eclipse >>with PyDev. I'm intending to create a GUI. I'm not able to understand >>the Grid manager perhaps because there is quite a less documentation >>available f

Re: RELEASED Python 2.6 final

2008-10-02 Thread Francesco Guerrieri
joking! Everybody knows that python developers never sleep :-) Congratulations for the final release! Francesco -- http://mail.python.org/mailman/listinfo/python-list

delete column content

2009-11-29 Thread Francesco Pietra
Hi: How to replace with blank the single-character in column 21 of a pdb file (in pdb numbering it is column 22). Attached is an incomplete exercise with slices. I am unable to get real plain text with gmail. Thanks for help francesco pietra # Sample line # Slice indexes cut to the left of the

Re: iterators and views of lists

2009-12-16 Thread Francesco Bochicchio
On Dec 16, 1:58 pm, Anh Hai Trinh wrote: > > You might be interested in this library stream>. > > You can easily create arbitrary "slice", for example > >   i = mylist >> takei(primes()) > > will return an iterator over the items of mylist with a prime number > ind

Re: How to iterate the input over a particular size?

2009-12-28 Thread Francesco Bochicchio
On 27 Dic, 22:29, joy99 wrote: > On Dec 27, 8:42 pm, Benjamin Kaplan wrote: > > > > > On Sun, Dec 27, 2009 at 9:44 AM, joy99 wrote: > > > Dear Group, > > > > I am encountering a small question. > > > > Suppose, I write the following code, > > > > input_string=raw_input("PRINT A STRING:") > > > s

Re: (help)Tkinter, how to make labels scrolling?

2009-12-28 Thread Francesco Bochicchio
On 28 Dic, 09:44, Ren Wenshan wrote: > Hi, everyone: > >    I am new to programming and Python and these days I've been working > on a > tiny program for practice and encountered with a problem. > >    My tiny program read a line from a data file one time, and store it > in a list, till the list i

Re: getting name of passed reference

2009-12-29 Thread Francesco Bochicchio
On 29 Dic, 00:54, Joel Davis wrote: > I'm just curious if anyone knows of a way to get the variable name of > a reference passed to the function. > > Put another way, in the example: > >   def MyFunc ( varPassed ): >      print varPassed; > >   MyFunc(nwVar) > > how would I get the string "nwVar"

Re: Need help to pass self.count to other classes.

2010-01-06 Thread Francesco Bochicchio
On 6 Gen, 11:11, Bill wrote: > After a year with Python 2.5 on my Windows box, I still have trouble > understanding classes. > > Below, see the batch file and the configuration script for > my Python interactive prompt. > > The widths of the secondary prompts increase when  the self.count of > Sys

Re: Want to call a method only once for unittest.TestCase--but not sure how?

2009-09-28 Thread Francesco Bochicchio
On Sep 28, 12:45 pm, Oltmans wrote: > Hello fellow python hackers, > > I'm not an expert when it comes to Python and I'm totally stuck in a > situation. All of our unit tests are written using built-in 'unittest' > module. We've a requirement where we want to run a method only once > for our unit

Re: UnboundLocalError - code is short & simple

2009-09-28 Thread Francesco Bochicchio
On Sep 28, 6:07 am, pylearner wrote: > System Specs: > > Python version = 2.6.1 > IDLE > Computer = Win-XP, SP2 (current with all windows updates) > > ---­- > > Greetings: > > I have written code for two things:  1

Re: Opinions, please, on PEP 8 and local, 3rd party imports

2009-10-03 Thread Francesco Bochicchio
On Oct 2, 9:50 pm, Philip Semanchuk wrote: > Hi all, > > PEP 8 says the following: > >     Imports should be grouped in the following order: >     1. standard library imports >     2. related third party imports >     3. local application/library specific

Re: Clear interface for mail class

2009-10-14 Thread Francesco Bochicchio
On Oct 14, 2:39 pm, Benedict Verheyen wrote: > Hi, > > I'm trying to come up with a decent interface for my email class. > Basically, i have one email function but it has many (too many?) variables: > >     send_mail(self, send_from, send_to, send_cc, subject, text, > separate_emails = False, fil

Re: Cpython optimization

2009-10-21 Thread Francesco Bochicchio
Il Wed, 21 Oct 2009 10:28:55 -0700, Qrees ha scritto: > Hello > > As my Master's dissertation I chose Cpython optimization. That's why i'd > like to ask what are your suggestions what can be optimized. Well, I > know that quite a lot. I've downloaded the source code (I plan to work > on Cpython 2

Re: "Hello, world"?

2009-10-28 Thread Francesco Bochicchio
On 28 Ott, 10:40, Gilles Ganault wrote: > Hello > > I'm reading O'Reily's "Python Programming on Win32", but couldn't find > a simple example on how to create a window with just a label and > pushbutton. > This is probably because maybe the book addresses how to use python to do windows-specific

Re: Feedback wanted on programming introduction (Python in Windows)

2009-10-28 Thread Francesco Bochicchio
> > Just to fuel the flame war, consider a million line Python system. It's not > uncommon with C++. :-) > In python, with one-miliion lines of code, you can demonstrate the existence of God, and then demostrate its non-existance by changing a single line of code :-) Ciao - FB -- http://ma

Re: Looking for help getting tkinter to work.

2009-11-01 Thread Francesco Bochicchio
On Nov 1, 4:06 am, Shue Boks wrote: > I tried to compile Python and Tcl/Tk on Linux using the following > files: > > Python-3.1.1.tar.gz > tcl8.5.7-src.tar.gz > > Cannot get tkinter to work after compiling & installing Tcl/Tk.  I get > the following error after compiling Python: > > "Python build

reposition a column

2009-11-25 Thread Francesco Pietra
complete the script. Much obliged for help. francesco pietra # Sample line # Slice indexes cut to the left of the corrresponding item index # 1 2 3 4 5 6 # 012345678901234567890123456789012345678901234567890123456789012345 ... # ATOM 1 W

Re: Can "self" crush itself?

2009-11-26 Thread Francesco Guerrieri
u can't > see your own eyes. > +1 QOTW Francesco -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing FILE * types using ctypes

2010-03-04 Thread Francesco Bochicchio
On Mar 4, 12:50 am, Zeeshan Quireshi wrote: > Hello, I'm using ctypes to wrap a library i wrote. I am trying to pass > it a FILE *pointer, how do i open a file in Python and convert it to a > FILE *pointer. Or do i have to call the C library using ctypes first, > get the pointer and then pass it t

Re: how to start a python script only once

2010-03-14 Thread Francesco Bochicchio
On 13 Mar, 19:45, News123 wrote: > Hi, > > I'd like to make sure, that a certain python program will only be run > once per host. (linux/windows) > > so if the program is started a second time it should just terminate and > let the other one run. > > This does not have to be the fastest solution,

Re: Case Sensitive Section names configparser

2010-12-08 Thread Francesco Bochicchio
On 8 Dic, 11:32, RedBaron wrote: > Is there any way by which configParser's get() function can be made > case insensitive? If you don't care about the case of the config parameter values, you could pre-convert the input to configParser all in UPPER or lower letter with a file-like object like thi

Re: multiple values for keyword argument

2011-01-29 Thread Francesco Bochicchio
On 29 Gen, 12:10, Tobias Blass wrote: > Hi all > I'm just learning python and use it to write a GUI (with Tkinter) for a C > program I already wrote. When trying to execute the program below I get the > following error message. > > Traceback (most recent call last): >   File "./abirechner.py", lin

Re: passing command line arguments to executable

2010-04-04 Thread Francesco Bochicchio
On 3 Apr, 19:20, mcanjo wrote: > On Apr 3, 11:15 am, Patrick Maupin wrote: > > > > > On Apr 3, 11:09 am, mcanjo wrote: > > > > I have an executable (I don't have access to the source code) that > > > processes some data. I double click on the icon and a Command prompt > > > window pops up. The p

Re: How to access args as a list?

2010-04-04 Thread Francesco Bochicchio
On 4 Apr, 00:58, kj wrote: > Suppose I have a function with the following signature: > > def spam(x, y, z): >     # etc. > > Is there a way to refer, within the function, to all its arguments > as a single list?  (I.e. I'm looking for Python's equivalent of > Perl's @_ variable.) > > I'm aware of

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread Francesco Bochicchio
On 1 Mag, 05:35, Steven D'Aprano wrote: > > def transfer_stock(stock_code, old_list, new_list): >     """ Transfer a stock from one list to another """ >     while True:  # loop forever >         try: >             i = old_list.index(stock_code) >         except ValueError: >             # not fo

Re: solve a newspaper quiz

2010-05-10 Thread Francesco Bochicchio
On 9 Mag, 11:20, superpollo wrote: > "if a b c are digits, solve ab:c=a*c+b" > > solved in one minute with no thought: > > for a in range(10): >      for b in range(10): >          for c in range(10): >              try: >                  if (10.*a+b)/c==a*c+b: >                      print "%i%i:

Re: First Tkinter script: requesting comments

2010-05-23 Thread Francesco Bochicchio
On 21 Mag, 23:51, Bart Kastermans wrote: > I wrote a first script using Tkinter.  As I am new to its > use, I am only just feeling my way around.  I would very > much like comments on the design of the script (and in fact > any other comments on my code would also be very welcome). > > I have it p

Re: Minor annoyances with properties

2010-05-27 Thread Francesco Bochicchio
On 27 Mag, 14:37, eb303 wrote: > Hello all, > > I've been using Python properties quite a lot lately and I've found a > few things that are a bit annoying about them in some cases. I > wondered if I missed something or if anybody else has this kind of > problems too, and if there are better soluti

Re: Weird Python behaviour

2010-08-10 Thread Francesco Bochicchio
hon arguments grouping feature : >>> class Family: ... def __init__(self, fName, *members ): ... self.members = list(members) # because members is a tuple ... self.fname = fName ... >>> f1 = Family("Smith") >>> f1.members.append("

Re: Weird Python behaviour

2010-08-10 Thread Francesco Bochicchio
On 10 Ago, 17:57, Stefan Schwarzer wrote: > Hi, > > On 2010-08-10 17:01, Francesco Bochicchio wrote: > > > There used to be a very nice (also graphic) explanationor this > > somewhere on the web, but my googling skills failed me this time, > > so instead I'll

Comparing lists

2010-08-16 Thread Francesco Bochicchio
Hi all, anybody can point me to a description of how the default comparison of list objects (or other iterables) works? Apparently l1 < l2 is equivalent to all ( x < y for x,y in zip( l1, l2) ), has is shown in the following tests, but I can't find it described anywhere: >>> [1,2,3] < [1,3,2

Extract value and average

2009-06-08 Thread Francesco Pietra
would like to extract values corresponding to variable DIHED (here 4660.1650) and getting also the mean value from all DIHED. Thanks for giving a possible attack francesco pietra NSTEP = 1000 TIME(PS) = 152.000 TEMP(K) = 298.54 PRESS =89.4 Etot = -134965.2

Fwd: Extract value and average

2009-06-08 Thread Francesco Pietra
t; yields a dictionary for each item in the input file. You can pull out whichever value(s) you want to manipulate. I recognize now that I did not define "block" correctly. The EWALD line, although separated by a blank line, makes part of the block. The layout of all ot

Re: EOF problem with ENTER

2009-06-12 Thread Francesco Bochicchio
On 12 Giu, 08:49, Prasoon wrote: > On Jun 12, 11:28 am, Chris Rebert wrote: > > > > > > > On Thu, Jun 11, 2009 at 11:17 PM, Prasoon wrote: > > > I am new to python > > > I have written the following program in python.It is the solution of > > > problem ETF in SPOJ. > > > > #Euler Totient

Re: Input problem

2009-06-16 Thread Francesco Bochicchio
On 16 Giu, 11:32, Prasoon wrote: > I am new to pythonand using python 2.6 > I want to know when to use raw_input( ) and when to use input( )??? > > According to my interpretation one should use input( ) when entering > numbers etc and > raw_input( ) when a string is too be entered. > > Cor

How to find info about python 3.x extension module availability?

2009-06-23 Thread Francesco Bochicchio
Hi all, is there any site that reports the current porting (to Python 3.x) status of the main non-standard extension modules (such as pygtk, pywin32, wxpython, ...) ? I think such information would be very useful for people - like me - which are tryiing to decide how/when/if to port existing scrip

Re: How to find info about python 3.x extension module availability?

2009-06-23 Thread Francesco Bochicchio
On 23 Giu, 12:59, Francesco Bochicchio wrote: > Hi all, > > is there any site that reports the current porting (to Python 3.x) > status of the main non-standard extension modules (such as pygtk, > pywin32, wxpython, ...) ? > I think such information would be very useful fo

Re: How to find info about python 3.x extension module availability?

2009-06-23 Thread Francesco Bochicchio
On 23 Giu, 17:12, Jeff McNeil wrote: > On Jun 23, 6:59 am, Francesco Bochicchio wrote: > > > > > > > Hi all, > > > is there any site that reports the current porting (to Python 3.x) > > status of the main non-standard extension modules (such as pygtk, &g

Recipes for trace statements inside python programs?

2009-06-25 Thread Francesco Bochicchio
Hi all, as many - I think - python programmers, I find muself debugging my scripts by placing print statements in strategic places rather than using the python debugger, and commenting/uncommenting them according to myy deugging needs. After a time, these prints staements start to evolving in som

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread Francesco Bochicchio
Sorry, hit the send button by mistake ... The definition of the trace function should be like: if __debug__ : def TRACE(*args): if trace_enabled(): print "TRACE(%s) : %s " % ( context(), " ".join( str(x) for x in args ) ) else : # optimazed code, only a func

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread Francesco Bochicchio
On 25 Giu, 13:15, koranthala wrote: > On Jun 25, 1:40 pm, Francesco Bochicchio wrote: > > > Is assert what you are looking for? > No. Assert raises exception if some condition is met. I just want to be able to enable/disable the printout of intermediate data, on a per functi

Re: file transfer in python

2009-06-26 Thread Francesco Bochicchio
On 26 Giu, 13:38, jayesh bhardwaj wrote: > i am trying to find something useful in python to transfer html files > from one terminal to other. Can this be done with some module or shall > i start coding my own module using low level socket interface. If u > know about some books on this topic or a

Re: fork, threads and proper closing

2009-06-29 Thread Francesco Bochicchio
On 29 Giu, 07:10, OdarR wrote: > On 28 juin, 23:26, Tomasz Pajor wrote: > > > Hello, > > > Configuration is as follows. > > > I have a starter process which creates 3 sub processes (forks) and each > > of this processes creates a number of threads. > > Threads in that processes have semaphore so

Unexpected behaviour of inner functions/ decorators

2009-06-30 Thread Francesco Bochicchio
Hi all, I found a strange (for me) behaviour of inner function. If I execute the following code: # file in_f.py --- def dec_f(f): def inner_f(): if f.enabled: f() return inner_f @dec_f def funct(): print "Ciao" funct.enabled = True funct() # end of file

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Francesco Bochicchio
On Jul 3, 12:46 pm, Klone wrote: > Hi all. I believe in programming there is a common consensus to avoid > code duplication, I suppose such terms like 'DRY' are meant to back > this idea. Anyways, I'm working on a little project and I'm using TDD > (still trying to get a hang of the process) and a

Re: tough-to-explain Python

2009-07-08 Thread Francesco Bochicchio
On Jul 7, 10:04 pm, kj wrote: > I'm having a hard time coming up with a reasonable way to explain > certain things to programming novices. > > Consider the following interaction sequence: > > >>> def eggs(some_int, some_list, some_tuple): > > ...     some_int += 2 > ...     some_list += [2] > ...

Re: comments? storing a function in an object

2009-07-20 Thread Francesco Bochicchio
On Jul 20, 6:22 pm, Esmail wrote: > Hello all, > > I am trying to store a function and some associated information in an > object so that I can later have series of functions in a list that I can > evaluate one at a time. > > Right now I am only storing the function itself, the number of > argumen

<    1   2   3   >