I wrote my very basic mkdocs plugin, hoping that it will inspire you to write your owns

2018-04-23 Thread francesco . maida
I wanted to write mkdocs plugins, so I read the docs (well, at least part of them) and I wrote a very simple, very basic plugin. I called it "Hello dolly", because when I wrote it I was inspired by the (once built-in) WordPress plugin of the same name that teached me the basic of plugin writing

Re: unittest.Testsuite and execution order

2018-04-19 Thread Francesco Russo
On 18/04/18 20:26, Chris Angelico wrote: > On Thu, Apr 19, 2018 at 2:51 AM, Francesco Russo > wrote: >> My use case: my SUT is split into modules. Besides writing unit tests for >> each module, I want to write an integration test, and I also need to >> perform some acti

unittest.Testsuite and execution order

2018-04-18 Thread Francesco Russo
his something that I can rely on for the future? I definitely don't want to rely on the current implementation, unless I see it in the documentation. If it's something that I can't rely on for the future, then I'd rather write my test code in a different way. Regards, Francesco P

Re: What should a decorator do if an attribute already exists?

2016-05-16 Thread Francesco Loffredo
happens if you want to add another instrument, decorating the target twice? Francesco -- https://mail.python.org/mailman/listinfo/python-list

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

lpod-python

2012-08-10 Thread Francesco
while the main site is working. I also tried to install the module with pip (I read on the site that it's now available), but again, no luck. Do somebody know what's happening to download.lpod-project.org ? It doesn't even ping... Please let me know, thank you very much. Franc

EuroPython 2012: Call for Proposal is Open! [Please spread the word]

2012-03-01 Thread Francesco Pallanti
Hi guys, I'm Francesco and I am writing on behalf of EuroPython Staff (www.europython.eu). We are happy to announce that the Call for Proposals is now officially open! DEADLINE FOR PROPOSALS: MARCH 18TH, 23:59:59 CET For those who have never been at EuroPython (or similar conferences) b

Deleted System default Python on Leopard

2012-01-16 Thread Francesco Zhu
lem report system of Apple it gives me these errors: http://bpaste.net/show/21904/ While this is the Console: http://bpaste.net/show/21905/ What problem can it be? Can I clean up all the Pythons and restore the system one? Thanks everyone. Regards, Francesco Zhu

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: 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: 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: 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: 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: python only prints integers

2011-01-06 Thread francesco
On 6 Gen, 23:59, Ian wrote: > On Jan 6, 3:49 pm, francesco wrote: > > > I'm pretty new in Python language. I have a problem with numbers: it > > seems python doesn't know any more how to count! > > I get only the down rounded integer > > 20/8 = 2 > &g

python only prints integers

2011-01-06 Thread francesco
I'm pretty new in Python language. I have a problem with numbers: it seems python doesn't know any more how to count! I get only the down rounded integer 20/8 = 2 8/3=2 I probably changed some option to round the numbers, but I don't remember how. Is there a way to reset the number of digits to def

Re: while True or while 1

2010-12-28 Thread Francesco
-1 -1 -1 47.55442856564332 that accounts for a scant 11% overhead, on more than one million tests per cycle. That said, let's make really clear that I would heartily prefer func2 to func1, based both on readability and speed. Thank you for having spent some time playing with me! Francesc

Re: If/then style question

2010-12-21 Thread Francesco
llion tests per cycle. That said, let's make really clear that I would heartily prefer func2 to func1, based both on readability and speed. Thank you for having spent some time playing with me! Francesco On 19/12/2010 1.05, Steven D'Aprano wrote: Well, let's try it with a working (albe

Re: If/then style question

2010-12-18 Thread Francesco
Apart from this, the overhead in the first one would amount to one million IF tests, again not a lot these days. I don't think I would rewrite that function, if I found it written in the first way... I don't mean that the fist example is better, just I'm sure you could imagine a

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

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

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

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

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: 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: 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: "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: 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: 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: 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: 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: 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: tool per conversione e trasformazione dati

2009-09-23 Thread Francesco Stablum
of "fixes"... a very complex job. I was wondering if there are any tool/frameworks to do such operations and if there exist a theoretical scientific branch where we can get some more informations to reorganize our scripts and programs. thanks for the attention, Francesco Stablum 2009/9/23

tool per conversione e trasformazione dati

2009-09-23 Thread Francesco Stablum
mework per effetturare operazioni di questo tipo e, allargando il discorso al di la di python, se esiste una disciplina teorica da dove possiamo attingere informazioni per riorganizzare i nostri programmi e script. ringrazio per l'attenzione, Francesco Stablum -- The generation of random

Re: VTK install

2009-09-15 Thread Francesco Bochicchio
On Sep 15, 6:29 am, Gib 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 in PYTHONPATH sh

Re: The future of Python immutability

2009-09-04 Thread Francesco Bochicchio
On Sep 3, 9:07 pm, Nigel Rantor 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 the threads,

Re: Newbie: list comprehension troubles..

2009-08-24 Thread Francesco Bochicchio
On 24 Ago, 01:27, mm 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): >                 tlist.append((obj,t)) > >

Re: conditional for-statement

2009-08-23 Thread Francesco Bochicchio
On Aug 23, 10:09 am, seb 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 i>5): >     print i > > sebastien AFAIK, no syntax fo that. But the standard syntax is not too different: for

Re: your favorite debugging tool?

2009-08-23 Thread Francesco Bochicchio
On Aug 22, 4:25 pm, Esmail 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 recommendations for Wi

Re: How to create ones own lib

2009-08-19 Thread Francesco Bochicchio
On 19 Ago, 11:00, Horst Jäger 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 python can fin

Re: flatten a list of list

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

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

2009-08-14 Thread Francesco Bochicchio
On 14 Ago, 18:03, kk 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 dynamic ip and

Re: variable & scoping question.

2009-08-10 Thread Francesco Bochicchio
On Aug 10, 5:12 pm, "Diez B. Roggisch" 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 test_effect(class_id=None,class_ids=[]):

Re: socket send

2009-07-31 Thread Francesco Bochicchio
On Jul 30, 10:16 pm, "Jan Kaliszewski" wrote: > 30-07-2009 o 12:29:24 Francesco Bochicchio wrote: > > > 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 s

Re: socket send

2009-07-30 Thread Francesco Bochicchio
On 30 Lug, 18:06, NighterNet wrote: > On Jul 30, 6:56 am, "Mark Tolonen" wrote: > > > > > > > "NighterNet" wrote in message > > >news:55aba832-df6d-455f-bf34-04d37eb06...@i4g2000prm.googlegroups.com... > > > >I am trying to figure out how to send text or byte in python3.1. I am > > > trying to s

Re: No PyPI search for 3.x compatible packages

2009-07-30 Thread Francesco Bochicchio
On 30 Lug, 01:55, Neil Hodgson 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 implementation language since there

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 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 [1] is r

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

New filters? was: Re: Bitwise 2009 ($5000 prize money)

2009-02-03 Thread Francesco Guerrieri
receive from clpy has greatly reduced in the last month or so. So it seems that the spam filters are doing a great job. Thanks are due to the people managing them :-) Francesco -- http://mail.python.org/mailman/listinfo/python-list

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

  1   2   3   >