Re: Python discussed in Nature

2015-02-15 Thread giacomo boffi
Chris Angelico writes: > On Sat, Feb 14, 2015 at 6:40 AM, John Ladasky > wrote: >> The default font that the Geany program editor uses on my Ubuntu >> system renders everything I've tried. When I look up that font in >> Geany's Preferences menu, it is called, simply, "monospace". >> > > That's

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-13 Thread giacomo boffi
"Clayton Kirkwood" writes: > Although I suspect for a price you could bring all of your > professional programming jobs to somebody here, but I think you > would pay out more than you would make. s/ here/ else/ and your assumption can be falsified -- https://mail.python.org/mailman/listinfo/pyt

Re: What does zip mean?

2014-11-13 Thread giacomo boffi
Grant Edwards writes: > No, you don't. That's not how a zipper works. Each tooth from side A, > isn't bound with one from side B. It's bound with _two_ of them from > side B. And each of those is in turn bound with an additional tooth > from side A, and so on... > >> In your program you have tw

Re: What does zip mean?

2014-11-10 Thread giacomo boffi
On 11/09/2014 11:44 AM, satishmlm...@gmail.com wrote: What does zip return in the following piece of code? To help you understanding what is the `zip` builtin, please forget about PKZip etc and think about the _zip fastener_ or _zipper_ in your bag or in your trousers In the bag you have two s

Re: I am out of trial and error again Lists

2014-10-27 Thread giacomo boffi
Rustom Mody writes: > What would you say to a person who > - Buys a Lambhorgini I'd say: "Don't buy a Lambhorgini from that nice guy you met at a party, but buy a Lamborghini by an authorized dealer" ;-) -- I was a kid when Lamborghini launched the Miura! -- https://mail.python.org

Re: I am out of trial and error again Lists

2014-10-24 Thread giacomo boffi
ERRATA CORRIGE: > many different circumstances, by the very, very helpful folks of clp. many different circumstances, by the very, very helpful folks of clpy -- sapete contare fino a venticinque? Olimpia Milano Jugoplastika Split Partizan Beograd Roberto Premier Duska Ivanovic Zarko Paspalj --

Re: I am out of trial and error again Lists

2014-10-23 Thread giacomo boffi
Seymore4Head writes: > Because most of the practice I am getting is not using Python. I > use Codeskulptor. Seymore, it's been months that you're struggling with python, if you happen to own a computer could you please take the time to install python on it and familiarise with the interactive

Re: I am out of trial and error again Lists

2014-10-23 Thread giacomo boffi
Rustom Mody writes: > [As best as I can make out the OP is not using the standalone > interpreter > nor idle > nor (the many options like) python-interpreter-inside-emacs > nor ipython > nor ... but CodeSkulptor ] CodeSkulptor has been mentioned recently by S4H, an

Re: Question about PANDAS

2014-10-20 Thread giacomo boffi
Ryan Shuell writes: > Thanks guys.  I just feel frustrated that I can't do something useful. I had read many of your messages in the recent past, and I'm under the impression that your frustration has more to do with "Python the Infrastructure" rather than "Python the Language" my suggestions w

Re: [OT] spelling colour / color was Re: Toggle

2014-10-18 Thread giacomo boffi
duncan smith writes: > [...] It was the "top / bottom of the [TV] programme" that I didn't > immediately get, because I was thinking of a timeline running left > to right (perhaps rather than the script used by the presenters). is it just me that thinks of a timeline running from the wall behind

Re: while loop - multiple condition

2014-10-14 Thread giacomo boffi
Tim Chase writes: > On 2014-10-12 22:16, Marko Rauhamaa wrote: >> is equivalent with >> >> while ans.lower()[0] != 'y': >> ans = input('Do you like python?') > > And still better improved with > > while ans[:1].lower() != 'y': > ans = input('Do you like python?') yok is Turk

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread giacomo boffi
Wiktor writes: > I'm not starting from scratch. I'm using packages 'termcolor', 'colorama' > and 'colorconsole' the 'urwid' package could be useful for similar projects but requires Linux, OSX, Cygwin or other unix-like OS so I guess it's of no use for you... ciao

Re: Hello and sorry for disturbing !

2014-05-27 Thread giacomo boffi
Rustom Mody writes: > For ubuntu you should need nothing for python. > In other words python should run on a basic ubuntu installation. > From the shell just type python and the interpreter should start. > > For more specialized work there are dozens (maybe hundreds?) of > packages in the apt rep

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
giacomo boffi writes: > % python a.py > 34131237 % cat a.py i="3443331123377";n=0 while n+1!=len(i):i,n=(i[:n]+i[n+1:],n) if i[n+1]==i[n] else (i,n+1) print i % python a.py 34131237 % -- for Nikos -- https://mail.python.org/mailman/listinfo/python-list

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
Nac Temha writes: > Hi everyone, > > I want to do operation with chars in the given string. Actually I want to > grouping the same chars. > > For example; > > input : "3443331123377" > operation-> (3)(44)()(333)(11)(2)(33)(77) > output: "34131237" > > > > How can I do without list

Re: ASCII and Unicode

2013-12-08 Thread giacomo boffi
Steven D'Aprano writes: > On Sat, 07 Dec 2013 17:05:34 +0100, giacomo boffi wrote: > >> Steven D'Aprano writes: >> >>> Ironically, your post was not Unicode. [...] Your post was sent using >>> a legacy encoding, Windows-1252, also known as CP

Re: ASCII and Unicode

2013-12-07 Thread giacomo boffi
Steven D'Aprano writes: > Ironically, your post was not Unicode. [...] Your post was sent > using a legacy encoding, Windows-1252, also known as CP-1252 i access rusi's post using a NNTP server, and in his post i see Content-Type: text/plain; charset=UTF-8 is it possible that what you see is

Re: Handling 3 operands in an expression without raising an exception

2013-09-29 Thread giacomo boffi
giacomo boffi writes: > it.comp.python oops, it.comp.LANG.python -- I do desire we may be better strangers. -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling 3 operands in an expression without raising an exception

2013-09-29 Thread giacomo boffi
Joel Goldstick writes: > On Sun, Sep 29, 2013 at 11:28 AM, giacomo boffi wrote: > > Νίκος writes: > > > IF it can also be written in one-line > > def f(x,n,w):return(lambda y=f(x[::2],n/2,w[::2]),z=f(x[1::2],n/2,w > [::2]):reduce(lambda x,y:x+y,zip(*[

Re: Handling 3 operands in an expression without raising an exception

2013-09-29 Thread giacomo boffi
Νίκος writes: > IF it can also be written in one-line def f(x,n,w):return(lambda y=f(x[::2],n/2,w[::2]),z=f(x[1::2],n/2,w[::2]):reduce(lambda x,y:x+y,zip(*[(y[k]+w[k]*z[k],y[k]-w[k]*z[k]) for k in range(n/2)])))()if n>1 else x -- anch'io la penso come me, ma -- SteO153,

Re: Help with python functions?

2013-09-24 Thread giacomo boffi
kjaku...@gmail.com writes: > def temp(T, from_unit, to_unit): > conversion_table = {('c', 'k'):lambda x: x + 273.15, > ('c', 'f'):lambda x: (x * (9.0/5)) + 32, > ('k', 'c'):lambda x: x - 273.15, > ('k', 'f'):lambda x: (x *

Re: CSV to matrix array

2013-04-13 Thread giacomo boffi
Ana Dionísio writes: > Hello! > > I have a CSV file with 20 rows and 12 columns and I need to store it > as a matrix. array=numpy.array([row for row in csv.reader(open('Cenarios.csv'))]) NB: i used "array=" as in your sample code, BUT -- http://mail.python.org/mailman/listinfo/python-list

PMW+BLT on windows, any chance?

2012-01-30 Thread Giacomo Boffi
on my linux box i have a small python program that draws some 2-d line graphs in a window aside a graphical interface to change the problem data as you may have guessed from the subject line, the gui widgets are done with help from PMW [1], and the graps are done by the PMW <-> BLT[2] interface n

Re: Validating Entry in tkinter

2011-07-27 Thread Giacomo Boffi
Saul Spatz writes: > In tcl/tk an Entry widget can be set to validate its contents with > the validate option. [...] Can one do something like this in > tkinter? i read the thread and nobody mentioned the python mega widget (Pmw) toolkit, from whose docs i quote the following Pmw.EntryField()

Re: Convert AWK regex to Python

2011-05-16 Thread Giacomo Boffi
J writes: > cat logs/pdu_log_fe.log | awk -F\- '{print $1,$NF}' | awk -F\. '{print > $1,$NF}' | awk '{print $1,$4,$5}' | sort | uniq | while read service command > status; do echo "Service: $service, Command: $command, Status: $status, > Occurrences: `grep $service logs/pdu_log_fe.log | grep $

Re: Fun python 3.2 one-liner

2011-04-04 Thread Giacomo Boffi
Chris Angelico writes: >> def f(x,n,w): return x if n==1 else\ >>    (lambda x0=f(x[::2],n/2,w[::2]),\ >>            x1=f(x[1::2],n/2,w[::2]): reduce(lambda a,b: a+b ,\ >>                                      zip(*[(x0[k]+w[k]*x1[k],\ >>                                             x0[k]-w[k]*x1[k

Re: [pyplot] using f1=figure(1)

2011-04-04 Thread Giacomo Boffi
"eryksun ()" writes: > figure(fig1.number) > plot(...) that's already much better than figure(1);...;figure(2);... > Alternatively, you can use the plot methods of a particular axes: > > fig1 = figure() > ax1 = axes() > fig2 = figure() > ax2 = axes() > > ax1.plot(...

Re: [pyplot] using f1=figure(1)

2011-03-28 Thread Giacomo Boffi
Blockheads Oi Oi writes: > I don't know why but this works fine. > f1=figure(1) > plot(sin(linspace(0,10)),figure=f1) > f2=figure(2) > plot(cos(linspace(0,10)),figure=f2) > show() it works as well (with a proper t...) plot(sin(t);figure(2);plot(cos(t));show() because that's the way it is advis

[pyplot] using f1=figure(1)

2011-03-28 Thread Giacomo Boffi
i executed the following interactions and i remained disappointed $ python Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pylab import * >>> f1=figure(1) >>> f2=figure(2) >>> f1 >>> f2 >>> pl

Re: Problems of Symbol Congestion in Computer Languages

2011-02-18 Thread Giacomo Boffi
Steven D'Aprano writes: >> A dedicated concatenation operator would have avoided that mess. > > I don't quite agree that the mess is as large as you make out, but yes, > more operators would be useful. am i wrong, or "|" is still available? -- l'amore e' un sentimento a senso unico. a volte un

Re: Problems of Symbol Congestion in Computer Languages

2011-02-18 Thread Giacomo Boffi
Chris Jones writes: > [...] most any software of note appears to have come out of cultures > where English is either the native language, or where the native > language is either relatively close to English... i do acknowledge your "most", but how do you spell "Moon" in Portuguese? -- http://ma

Re: Should there be a 'core' python install?

2011-01-20 Thread Giacomo Boffi
"Martin P. Hellwig" writes: > Yep when I started looking much more at other toolkits, I started to > like Tkinter more and more. Maybe its simplicity, maybe the good design of Tk, -- BOMBED BY AIRCRAFT. SINKING. U-824. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using property() to extend Tkinter classes but Tkinter classes are old-style classes?

2010-11-30 Thread Giacomo Boffi
Terry Reedy writes: > On 11/28/2010 3:47 PM, pyt...@bdurham.com wrote: >> I had planned on subclassing Tkinter.Toplevel() using property() to wrap >> access to properties like a window's title. >> After much head scratching and a peek at the Tkinter.py source, I >> realized that all Tkinter class

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Giacomo Boffi
harryos writes: > hi > I have 2 lists of numbers,say > x=[2,4,3,1] > y=[5,9,10,6] > I need to create another list containing > z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] > > I did not want to use numpy or any Array types.I tried to implement > this in python .I tried the following > > z=[] > for a

Re: [Tutor] Arguments from the command line

2010-09-13 Thread Giacomo Boffi
Dennis Lee Bieber writes: > On Fri, 10 Sep 2010 12:25:17 +0200, Giacomo Boffi > declaimed the following in > gmane.comp.python.general: > >> Lawrence D'Oliveiro writes: >> >> > In message <8662yfklzu....@aiuole.stru.polimi.it>, Giacomo Boffi

Re: [Tutor] Arguments from the command line

2010-09-10 Thread Giacomo Boffi
Lawrence D'Oliveiro writes: > In message <8662yfklzu@aiuole.stru.polimi.it>, Giacomo Boffi wrote: > >> Dennis Lee Bieber writes: >> >>> FORTRAN just differentiates by having the main file start with >>> PROGRAM random_name >>>

Re: How Python works: What do you know about support for negative indices?

2010-09-10 Thread Giacomo Boffi
Ben Finney writes: > Raymond Hettinger writes: > >> It doesn't seem to be common knowledge when and how a[x] gets >> translated to a[x+len(x)]. So, here's a short info post on how Python >> supports negative indices for sequences. > > Thanks for this. Could you post your messages using a channe

Re: [Tutor] Arguments from the command line

2010-09-09 Thread Giacomo Boffi
Dennis Lee Bieber writes: > FORTRAN just differentiates by having the main file start with > PROGRAM random_name > whereas subfiles are all either (or both) > SUBROUTINE another_name(args) > FUNCTION that_other_name(args) no BLOCKDATA? -- http://m

Re: PyGeo

2010-08-31 Thread Giacomo Boffi
L writes: > also the PyGeo readme text mentions Numerical python (I think it > means Numeric, but I also have NumPy installed) afaict, Numerical python is numpy --- if you look at pygeo home page, the reference to Numerical python is a link to numpy home page on the contrary, there is no "impor

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-17 Thread Giacomo Boffi
Paul Rubin writes: > Baba writes: >> exercise: given that packs of McNuggets can only be bought in 6, 9 or >> 20 packs, write an exhaustive search to find the largest number of >> McNuggets that cannot be bought in exact quantity. > > Is that a homework problem? yes, and no it was a homework p

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Giacomo Boffi
Baba writes: > Hi Mel, > > indeed i thought of generalising the theorem as follows: > If it is possible to buy n, n+1,~, n+(x-1) sets of McNuggets, for some > x, then it is possible to buy any number of McNuggets >= x, given that > McNuggets come in x, y and z packs. > > so with diophantine_nugge

Re: Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?

2010-08-11 Thread Giacomo Boffi
"Martin v. Loewis" writes: > If you use the bdist_wininst, bdist_msi, or bdist_rpm distutils > commands, you get packages which support uninstallations very well. bdist_deb? -- Vorrei andare a lavorare in Sicilia, a max 15 km dal mare. Con chi devo parlare? Col capomafia distrettuale? Oppure b

Re: Python -- floating point arithmetic

2010-07-08 Thread Giacomo Boffi
"Zooko O'Whielacronx" writes: > I'm starting to think that one should use Decimals by default and > reserve floats for special cases. would you kindly lend me your Decimals ruler? i need to measure the sides of the triangle whose area i have to compute -- http://mail.python.org/mailman/listinfo

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Giacomo Boffi writes: > Hans Georg Schaathun writes: > >> : import matplotlib >> : matplotlib.use('agg') >> : import pylab >> : pylab.plot([1, 3, 5]) >> : fig = file('foo.png', 'wb') >> : pyla

Re: Plotting in batch with no display

2010-06-08 Thread Giacomo Boffi
Hans Georg Schaathun writes: > : import matplotlib > : matplotlib.use('agg') > : import pylab > : pylab.plot([1, 3, 5]) > : fig = file('foo.png', 'wb') > : pylab.savefig(fig, format='png') > : fig.close() > > Raster graphics is not good enough #ig = file('foo.p

Re: if, continuation and indentation

2010-06-04 Thread Giacomo Boffi
HH writes: > if (width == 0 and > height == 0 and > color == 'red' and > emphasis == 'strong' or > highlight > 100): > raise ValueError("sorry, you lose") if (width == 0 and height == 0 and color == 'red' and emphasis == 'strong' or

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
Giacomo Boffi writes: >> However, given you example, you should not insert code execution at >> you module level, unless it's required only at the module import. I >> dont know what is your module > > module? this was not well specified in my OP, but i'd rather

Re: [pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
Jean-Michel Pichavant writes: > Giacomo Boffi wrote: >> i have this code >> >> def example(a): >> return lambda b: a+b+1 >> >> fun = example(10) >> k_1 = fun(7) >> ... >> >> and pylint tells me >> >> [...] >>

[pylint] why pylint wants only capitals identifiers?

2010-04-19 Thread Giacomo Boffi
i have this code def example(a): return lambda b: a+b+1 fun = example(10) k_1 = fun(7) ... and pylint tells me [...] C: 4: Invalid name "fun" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 5: Invalid name "k_1" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) [...] afaict, [A-Z_][A-Z0-9_]

Re: Generating a rainbow?

2010-04-13 Thread Giacomo Boffi
Tobiah writes: > I'm having a difficult time with this. I want > to display a continuous range of hues using HTML > hex representation (#RRGGBB). How would I go > about scanning through the hues in order to > make a rainbow? if you mean real rainbows when you say "rainbow", as rainbows go fro

Re: python as pen and paper substitute

2010-04-09 Thread Giacomo Boffi
Manuel Graune writes: > Giacomo Boffi writes: > >> Manuel Graune writes: >> >>> Hello everyone, >>> >>> I am looking for ways to use a python file as a substitute for simple >>> pen and paper calculations. >> >> search(

Re: python as pen and paper substitute

2010-04-08 Thread Giacomo Boffi
Manuel Graune writes: > Hello everyone, > > I am looking for ways to use a python file as a substitute for simple > pen and paper calculations. search("embedded calc mode") if manuel in emacs_fellows_set or sys.exit(1) -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommend Commercial graphing library

2010-04-08 Thread Giacomo Boffi
Grant Edwards writes: > If it's 2D data, you don't need to use a 3D graph. if it's tabular data, you don't need an uber-histogram -- giampippetto, coso, come si chiama? ah si` "MMAX" ha scritto: > Tra il trascendente e l'interpretazione prevalente del dato come > assioma ne passa... -- http://

Re: Looking for a pure Python chart drawing module

2009-09-18 Thread Giacomo Boffi
Piet van Oostrum writes: >> Chris Withers (CW) wrote: > >>CW> John Nagle wrote: That's a wrapper for Antigrain ("http://www.antigrain.com/";), which is a C++ library. I'm trying hard to avoid dependencies on binary libraries with limited support. Builds exist only for P

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Giacomo Boffi
John Nagle writes: > gerlos wrote: >> John Nagle ha scritto: >> >>> I'm looking for something that can draw simple bar and pie charts >>> in Python. I'm trying to find a Python package, not a wrapper for >>> some C library, as this has to run on both Windows and Linux >>> and version clashes are

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Giacomo Boffi
Vlastimil Brom writes: > As for BLT, there is Pmw.Blt, the original is written in Tcl. doesn't work (dumps core) on debian linux bug #525860: python-pmw triggers segmentation fault in blt not that blt itself is really OK bug #524149: blt: zooming in a graph produces segmentation fault -

Re: Help with cumulative sum

2009-09-11 Thread Giacomo Boffi
Maggie writes: > [...] > else: >print 'The loop is finito' do you know of it.comp.lang.python? -- Sarebbe essere un atto di pieta'. Contro i miei principi.-- whip, in IFMdI -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tkinter] messed callbacks

2009-09-10 Thread Giacomo Boffi
Terry Reedy writes: > Reedy's Lambda Rule: [detailed explanation omitted] i'm beginning to _understand_ what's going on with my code > Terry Jan Reedy thanks, grazie 1000 Terry, g -- "Lord, what fools these mortals be!" -- http://mail.

Re: [Tkinter] messed callbacks

2009-09-10 Thread Giacomo Boffi
John Posner writes: > def output(x,y,op): > if op == "<": >print x, "<---", y > elif op == ">": >print x, "--->", y > else: >print "Operation argument error!" uh, nice!, i'll adapt this to my real problem thank you John,

Re: [Tkinter] messed callbacks

2009-09-10 Thread Giacomo Boffi
Scott David Daniels writes: > Giacomo Boffi wrote: >> Giacomo Boffi writes: > ... >> | def create_cb(a,b): >> | return lambda: output(a+'->'+b) >> | | def doit(fr,lst): >> | for c1,c2 in zip(lst[::2], lst[1::2]): >> | subframe=F

Re: [Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
Giacomo Boffi writes: > ok, i'll try again following your advice ,[ test.py ] | from Tkinter import * | | def output(s): | print s | | def create_cb(a,b): | return lambda: output(a+'->'+b) | | def doit(fr,lst): | for c1,c2 in zip(lst[::2], lst[1::2]): |

Re: [Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
"Diez B. Roggisch" writes: > Giacomo Boffi wrote: > >> def doit(fr,lst): >> for c1,c2 in zip(lst[::2], lst[1::2]): >> subframe=Frame(fr) >> Label(subframe,text=c1+' <-> >> '+c2).pack(side='left',expand=1,fill=&

[Tkinter] messed callbacks

2009-09-09 Thread Giacomo Boffi
i have this test program (that i already posted on it.comp.lang.python) [ test.py ] from Tkinter import * def output(s): print s def doit(fr,lst): for c1,c2 in zip(lst[::2], lst[1::2]): subframe=Frame(fr) Label(subframe,text=c1+' <-> '+c2).pack(side='left',expand=1,fill='both')

tkinter+matplotlib

2006-03-27 Thread Giacomo Boffi
i have coded some progs that use the Pmw.Blt.Graph widgets, embedded in a simple Tkinter GUI , | from Tkinter import * | import Pmw | ... | frame=Frame(root) | ... | graph=Pmw.Blt.Graph(frame,...) | graph.line_create(...) | graph.pack(...) ` now i'd like to port those progs to an environm

Re: [Pmw] reusing a graph after deleting a curve

2005-03-16 Thread giacomo boffi
giacomo boffi <[EMAIL PROTECTED]> writes: > my question: is it possible to erase a graph, and reuse it? > > like in > > # x -> compute -> y > g=Pmw.Blt.Graph(); g.pack() > g.line_create(name,x,y) > # other computing -> a better y > # do something to g, e

[Pmw] reusing a graph after deleting a curve

2005-03-10 Thread giacomo boffi
my question: is it possible to erase a graph, and reuse it? like in # x -> compute -> y g=Pmw.Blt.Graph(); g.pack() g.line_create(name,x,y) # other computing -> a better y # do something to g, erasing the previous plot #[the above is the part that i cannot understand...] g.line_create(name,x