Re: Square bracket and dot notations?

2011-06-11 Thread Francesco Bochicchio
On 11 Giu, 11:41, Asen Bozhilov wrote: > Hi all, > I am beginner in Python. What is interesting for me is that Python > interpreter treats in different way dot and square bracket notations. > I am coming from JavaScript where both notations lead prototype chain > lookup. > > In Python it seems squ

Re: Maximize already running tkinter program on invocation

2011-07-27 Thread Francesco Bochicchio
On 27 Lug, 10:18, Steven Kauffmann wrote: > Hi all, > > I have written a small GUI application in python 3.x using the tkinter > module. Program is running fine, but multiple instances of the program > can now be created. I would like to reduce the number of instances of > the program to only 1 in

Re: Is there any python library that parse c++ source code statically

2011-03-13 Thread Francesco Bochicchio
On 13 Mar, 10:14, kuangye wrote: > Hi, all. I need to generate other programming language source code > from C++ source code for a project. To achieve this, the first step is > to "understand" the c++ source code at least in formally. Thus is > there any library to parse the C++ source code static

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_0403&PID_6010&MI_00\7&15E4F68&1&"$) > > 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 i

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 o

Re: Python declarative

2014-01-17 Thread Francesco Bochicchio
Some time ago I played with Tkinter trying a more declarative way of coding the GUI building part and I come out with this: top = Tk( 'top' ).add ( Frame( 'frame' ).add ( Pack( side = 'top' ), Frame ( 'panel1' ).add ( Pack( s

Re: Python declarative

2014-01-19 Thread Francesco Bochicchio
Looking at my own code after four years, I just realized that most of parentheses can be avoided by redefining the += operators to be a synonym of the add method. Go figure, I guess that with age it _does_ come a little wisdom ... :-) Ciao - FB -- https://mail.python.org/mailman/listinfo/p

Re: I love the decorator in Python!!!

2011-12-09 Thread Francesco Bochicchio
On 8 Dic, 12:22, K.-Michael Aye wrote: > On 2011-12-08 08:59:26 +, Thomas Rachel said: > > > > > Am 08.12.2011 08:18 schrieb 8 Dihedral: > >> I use the @ decorator to behave exactly like a c macro that > >> does have fewer side effects. > > >> I am wondering is there other interesting meth

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

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 use

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 r

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

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: 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 "j

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 =

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

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

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

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:

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

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
On 10 Ago, 13:58, Jonas Nilsson 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 to

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

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

Re: Popen

2009-07-24 Thread Francesco Bochicchio
On Jul 24, 6:24 pm, Tim 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") != -1: >

Re: socket send

2009-07-30 Thread Francesco Bochicchio
On Jul 30, 5:52 am, NighterNet 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' before the co

  1   2   >