Re: Arguments for button command via Tkinter?

2005-10-31 Thread Francesco Bochicchio
Il Mon, 31 Oct 2005 06:23:12 -0800, [EMAIL PROTECTED] ha scritto: And yet the stupidity continues, right after I post this I finnally find an answer in a google search, It appears the way I seen it is to create a class for each button and have it call the method within that. If anyone else

Re: Windows - Need to process quotes in string...

2005-10-31 Thread Francesco Bochicchio
Il Mon, 31 Oct 2005 07:18:31 -0800, Ernesto ha scritto: I'm trying to use a $ delimeter, but it doesn't seem to work. Here is the code: launchWithoutConsole(devcon.exe,d'$enable @USB\VID_0403PID_6010MI_00\715E4F681$) I want to send the string parameter: enable

Re: Arguments for button command via Tkinter?

2005-11-01 Thread Francesco Bochicchio
Il Mon, 31 Oct 2005 19:23:18 +, Steve Holden ha scritto: Francesco Bochicchio wrote: Il Mon, 31 Oct 2005 06:23:12 -0800, [EMAIL PROTECTED] ha scritto: And yet the stupidity continues, right after I post this I finnally find an answer in a google search, It appears the way I seen

Re: Newbie Alert: Help me store constants pythonically

2005-11-06 Thread Francesco Bochicchio
Il Sun, 06 Nov 2005 08:33:17 -0800, Brendan ha scritto: Hi all I'm new to Python (and programming in general), and I can't decide what is the most 'pythonic' way to approach a problem. Your advice would be appreciated. I have a bunch of 'scans', containing the data measured from one of

Re: Tkinter. Why the Need for a Frame, or no Frame?

2008-02-17 Thread Francesco Bochicchio
On Sat, 16 Feb 2008 19:40:51 -0800, W. Watson wrote: from Tkinter import * class App: def __init__(self, master): fm = Frame(master) Button(fm, text='Left').pack(side=LEFT) Button(fm, text='This is the Center button').pack(side=LEFT) Button(fm,

Re: Pyparsing help

2008-03-24 Thread Francesco Bochicchio
Il Sat, 22 Mar 2008 14:11:16 -0700, rh0dium ha scritto: Hi all, I am struggling with parsing the following data: test1 = Technology { name= gtc dielectric = 2.75e-05 unitTimeName

python library to manipulate PALM documents ?

2008-03-24 Thread Francesco Bochicchio
Hi all, anybody knows a python equivalent of the perl PALM::Doc module (and eventually other PALM::). I have a e-book device wich reads mobi-pocket format (among others). I have downloaded from a forum a set of perl scripts to convert HTML to unencripted mobipocket format and vice-versa. It

Re: Disable resize button

2008-03-24 Thread Francesco Bochicchio
Il Mon, 24 Mar 2008 04:38:50 -0700, myonov ha scritto: Hi! I need to disable resize button in Tkinter. I inherit the Frame class. Then in the constructor i make my buttons, labels, etc. Then I pack them and when move borders of the frame everything changes it's location and it looks really

Re: python library to manipulate PALM documents ?

2008-03-24 Thread Francesco Bochicchio
Il Mon, 24 Mar 2008 12:08:59 -0300, Guilherme Polo ha scritto: 24 Mar 2008 13:36:13 GMT, Francesco Bochicchio [EMAIL PROTECTED]: Hi all, anybody knows a python equivalent of the perl PALM::Doc module (and eventually other PALM::). I have a e-book device wich reads mobi-pocket format

Re: Shortcutting the function call stack

2008-03-25 Thread Francesco Bochicchio
Il Mon, 24 Mar 2008 15:05:38 -0700, Julien ha scritto: ... I'll try to explain a bit more what I'm after, and hopefully that will be clearer. In fact, what I'm trying to do is to hijack (I'm making up the term) a function: def hijacker(arg): if I_feel_its_necessary:

Re: Python 2.2.1 and select()

2008-03-25 Thread Francesco Bochicchio
Il Mon, 24 Mar 2008 17:58:42 -0400, Derek Martin ha scritto: Hi kids! I've got some code that uses select.select() to capture all the output of a subprocess (both stdout and stderr, see below). This code works as expected on a variety of Fedora systems running Python 2.4.0, but on a

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 _c[0]])+[c[0]] +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

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. obv i

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 pgm

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 knowing

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 a

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 this.

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 alan.is...@gmail.com 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

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 a

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,  ericwoodwo...@gmail.com wrote: I'm using queues to talk between these threads so I could certainly

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

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 tadweles...@gmail.com 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

Re: Definition of Pythonic?

2009-04-13 Thread Francesco Bochicchio
John Yeung ha scritto: On Apr 11, 10:08 am, Emmanuel Surleau emmanuel.surl...@gmail.com 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

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 for it on

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 easier

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

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

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 to make

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] processor]#

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:    print

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. In

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

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Grant Edwards ha scritto: On 2008-12-30, Francesco Bochicchio bock...@virgilio.it 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

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 bock...@virgilio.it 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

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 TCP protocol recv

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

Re: select.select and socket.setblocking

2008-12-31 Thread Francesco Bochicchio
Saju Pillai ha scritto: On Dec 31, 7:48 pm, Francesco Bochicchio bock...@virgilio.it 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

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

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 ...

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\python26python c:\python26\work\brian.py. Now i understand that- because I set the Pythonpath- the

Re: Implementing file reading in C/Python

2009-01-10 Thread Francesco Bochicchio
On Fri, 09 Jan 2009 15:34:17 +, MRAB wrote: Marc 'BlackJack' Rintsch wrote: On Fri, 09 Jan 2009 04:04:41 +0100, Johannes Bauer wrote: As this was horribly slow (20 Minutes for a 2GB file) I coded the whole thing in C also: Yours took ~37 minutes for 2 GiB here. This just ~15

Re: pep 8 constants

2009-01-18 Thread Francesco Bochicchio
On Wed, 14 Jan 2009 08:13:30 +, Steven D'Aprano wrote: Absolutely. It's rather sad that I can do this: import math math.pi = 3.0 I like the ability to shoot myself in the foot, thank you very much, but I should at least get a warning when I'm about to do so: math.PI = 3.0 #

Re: file write collision consideration

2009-01-20 Thread Francesco Bochicchio
On Tue, 20 Jan 2009 11:08:46 -0500, D'Arcy J.M. Cain wrote: On Tue, 20 Jan 2009 10:57:52 -0500 RGK bl...@empty.blank wrote: I have a thread that is off reading things some of which will get written into a file while another UI thread manages input from a user. The reader-thread and the

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

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 aac004f8-2077-4e53-a865-47c24f7f5...@t3g2000yqa.googlegroups.com, Alia K alia_kho...@yahoo.com wrote: Nevertheless, I remain curious about whether once can use the contextmanager in python to achieve the full power of ruby's blocks...

Re: Hello, world?

2009-10-28 Thread Francesco Bochicchio
On 28 Ott, 10:40, Gilles Ganault nos...@nospam.com 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

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 --

Re: Looking for help getting tkinter to work.

2009-11-01 Thread Francesco Bochicchio
On Nov 1, 4:06 am, Shue Boks shoebox56car...@gmail.com 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:

Re: iterators and views of lists

2009-12-16 Thread Francesco Bochicchio
On Dec 16, 1:58 pm, Anh Hai Trinh anh.hai.tr...@gmail.com wrote: You might be interested in this library http://pypi.python.org/pypi/ 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

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

2009-12-28 Thread Francesco Bochicchio
On 27 Dic, 22:29, joy99 subhakolkata1...@gmail.com wrote: On Dec 27, 8:42 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sun, Dec 27, 2009 at 9:44 AM, joy99 subhakolkata1...@gmail.com wrote: Dear Group, I am encountering a small question. Suppose, I write the following

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

2009-12-28 Thread Francesco Bochicchio
On 28 Dic, 09:44, Ren Wenshan renws1...@gmail.com 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,

Re: getting name of passed reference

2009-12-29 Thread Francesco Bochicchio
On 29 Dic, 00:54, Joel Davis callmeclaud...@gmail.com 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

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

2010-01-06 Thread Francesco Bochicchio
On 6 Gen, 11:11, Bill bsag...@gmail.com 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

Re: Passing FILE * types using ctypes

2010-03-04 Thread Francesco Bochicchio
On Mar 4, 12:50 am, Zeeshan Quireshi zeeshan.quire...@gmail.com 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

Re: your favorite debugging tool?

2009-08-23 Thread Francesco Bochicchio
On Aug 22, 4:25 pm, Esmail ebo...@hotmail.com wrote: Hi all, What is your favorite tool to help you debug your code? I've been getting along with 'print' statements but that is getting old and somewhat cumbersome. I'm primarily interested in utilities for Linux (but if you have

Re: conditional for-statement

2009-08-23 Thread Francesco Bochicchio
On Aug 23, 10:09 am, seb sdemen...@gmail.com wrote: Hi, i was wondering if there is a syntax alike: for i in range(10) if i 5:     print i equivalent to for i in (for i in range(10) if i5):     print i sebastien AFAIK, no syntax fo that. But the standard syntax is not too different:

Re: Newbie: list comprehension troubles..

2009-08-24 Thread Francesco Bochicchio
On 24 Ago, 01:27, mm matta...@gmail.com wrote: Hi, I'm trying to replace this...         # this works but there must be a more pythonic way, right?         tlist = []         for obj in self.objs:             t = obj.intersect(ray)             if (t != None):                

Re: The future of Python immutability

2009-09-04 Thread Francesco Bochicchio
On Sep 3, 9:07 pm, Nigel Rantor wig...@wiggly.org wrote: Right, this is where I would love to have had more experience with Haksell. Yes, as soon as you get to a situation where no thread can access shared state that is mutable your problems go away, you're also getting no work done becasue

Re: VTK install

2009-09-15 Thread Francesco Bochicchio
On Sep 15, 6:29 am, Gib gib.bo...@gmail.com wrote: As part of the MayaVi install, I need to install VTK.   ... Since VTK appears to be installed, I'm guessing that either the path setting is wrong, or python is not using PYTHONPATH.  How can I check that PYTHONPATH is being used? The paths

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 rolf.oltm...@gmail.com 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

Re: UnboundLocalError - code is short simple

2009-09-28 Thread Francesco Bochicchio
On Sep 28, 6:07 am, pylearner for_pyt...@yahoo.com 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

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 phi...@semanchuk.com wrote: Hi all, PEP 8 http://www.python.org/dev/peps/pep-0008/ says the following:     Imports should be grouped in the following order:     1. standard library imports     2. related third party imports     3. local

Re: Clear interface for mail class

2009-10-14 Thread Francesco Bochicchio
On Oct 14, 2:39 pm, Benedict Verheyen benedict.verhe...@gmail.com 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,

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.6

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

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 bieff...@gmail.com 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 for people

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 j...@jmcneil.net wrote: On Jun 23, 6:59 am, Francesco Bochicchio bieff...@gmail.com 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

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

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

Re: Recipes for trace statements inside python programs?

2009-06-25 Thread Francesco Bochicchio
On 25 Giu, 13:15, koranthala koranth...@gmail.com wrote: On Jun 25, 1:40 pm, Francesco Bochicchio bieff...@gmail.com 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

Re: file transfer in python

2009-06-26 Thread Francesco Bochicchio
On 26 Giu, 13:38, jayesh bhardwaj bhardwajjay...@gmail.com 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

Re: fork, threads and proper closing

2009-06-29 Thread Francesco Bochicchio
On 29 Giu, 07:10, OdarR olivier.da...@gmail.com wrote: On 28 juin, 23:26, Tomasz Pajor ni...@puffy.pl 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

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 hkm...@gmail.com 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

Re: tough-to-explain Python

2009-07-08 Thread Francesco Bochicchio
On Jul 7, 10:04 pm, kj no.em...@please.post 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 +=

Re: comments? storing a function in an object

2009-07-20 Thread Francesco Bochicchio
On Jul 20, 6:22 pm, Esmail ebo...@hotmail.com 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

Re: Popen

2009-07-24 Thread Francesco Bochicchio
On Jul 24, 6:24 pm, Tim timlee...@yahoo.com wrote: Thanks! Yes I mean subprocess.Popen. I was wondering the meaning of asynchronously Here is some code I am reading recently: result = Popen(cmdline,shell=True,stdout=PIPE).stdout for line in result.readlines():     if find(line,Cross) !=

Re: socket send

2009-07-30 Thread Francesco Bochicchio
On Jul 30, 5:52 am, NighterNet darkne...@gmail.com wrote: I am trying to figure out how to send text or byte in python 3.1. I am trying to send data to flash socket to get there. I am not sure how to work it. buff= 'id=' , self.id , ':balive=False\n' clientSock.send(buff); Try putting a 'b'

Python processors? : WAS Re: Does python have the capability for driver development ?

2009-07-30 Thread Francesco Bochicchio
On Jul 30, 11:10 am, Christian Heimes li...@cheimes.de wrote: Martin P. Hellwig wrote: Well the pyc, which I thought was the Python bytecode, is then interpreted by the VM. Python is often referred as byte-code interpreted language. Most modern languages are interpreted languages. The list

Re: No PyPI search for 3.x compatible packages

2009-07-30 Thread Francesco Bochicchio
On 30 Lug, 01:55, Neil Hodgson nyamatongwe+thun...@gmail.com wrote:    There appears to be no way to search PyPI for packages that are compatible with Python 3.x. There are classifiers for 'Programming Language' including 'Programming Language :: Python :: 3' but that seems to be for

Re: socket send

2009-07-30 Thread Francesco Bochicchio
On 30 Lug, 18:06, NighterNet darkne...@gmail.com wrote: On Jul 30, 6:56 am, Mark Tolonen metolone+gm...@gmail.com wrote: NighterNet darkne...@gmail.com wrote in message news:55aba832-df6d-455f-bf34-04d37eb06...@i4g2000prm.googlegroups.com... I am trying to figure out how to send text

Re: socket send

2009-07-31 Thread Francesco Bochicchio
On Jul 30, 10:16 pm, Jan Kaliszewski z...@chopin.edu.pl wrote: 30-07-2009 o 12:29:24 Francesco Bochicchio bieff...@gmail.com wrote: On Jul 30, 5:52 am, NighterNet darkne...@gmail.com wrote: I am trying to figure out how to send text or byte in python 3.1. I am trying to send data to flash

Re: variable scoping question.

2009-08-10 Thread Francesco Bochicchio
On Aug 10, 5:12 pm, Diez B. Roggisch de...@nospam.web.de wrote: Cornelius Keller wrote: Hi, I'm a quite fresh python programmer, (6 Month python experience). Today I found something I absolotly don'nt understand: given the following function: def

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Francesco Bochicchio
On 14 Ago, 18:03, kk maymunbe...@gmail.com wrote: Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my

Re: flatten a list of list

2009-08-16 Thread Francesco Bochicchio
On Aug 16, 1:25 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: ... Chris' suggestion using itertools seems pretty good: from timeit import Timer setup = \\ ... L = [ [None]*5000 for _ in xrange(%d) ] ... from itertools import chain ...

Re: How to create ones own lib

2009-08-19 Thread Francesco Bochicchio
On 19 Ago, 11:00, Horst Jäger h.jae...@medienkonzepte.de wrote: Hi, I would like to create my own lib hotte.py which I can import like         import string,hotte . How do I do that? I'm working on MacOS 10.5.6 . Thanks in advance Just create the file 'hotte.py' and place it somewhere

Re: Weird Python behaviour

2010-08-10 Thread Francesco Bochicchio
On 10 Ago, 13:58, Jonas Nilsson j...@spray.se wrote: Hello, Lets say that I want to feed an optional list to class constructor: class Family():         def __init__(self, fName, members = []):                 self.fName = fName                 self.members = members Now, lets add members

Re: Weird Python behaviour

2010-08-10 Thread Francesco Bochicchio
On 10 Ago, 17:57, Stefan Schwarzer sschwar...@sschwarzer.net 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 show you the concept

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]

Re: how to start a python script only once

2010-03-14 Thread Francesco Bochicchio
On 13 Mar, 19:45, News123 news1...@free.fr 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

Re: passing command line arguments to executable

2010-04-04 Thread Francesco Bochicchio
On 3 Apr, 19:20, mcanjo mca...@gmail.com wrote: On Apr 3, 11:15 am, Patrick Maupin pmau...@gmail.com wrote: On Apr 3, 11:09 am, mcanjo mca...@gmail.com 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

Re: How to access args as a list?

2010-04-04 Thread Francesco Bochicchio
On 4 Apr, 00:58, kj no.em...@please.post 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.)

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 st...@remove-this- cybersource.com.au 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

  1   2   >