Re: Future standard GUI library

2013-05-22 Thread Chris Angelico
On Thu, May 23, 2013 at 4:43 PM, Fábio Santos wrote: > On 23 May 2013 03:39, "llanitedave" wrote: >> On Wednesday, May 22, 2013 7:24:15 AM UTC-7, Chris Angelico wrote: >> > there's another option that is available to every platform and >> > (practially) every high level language: the web browser.

Re: Future standard GUI library

2013-05-22 Thread Fábio Santos
On 23 May 2013 03:39, "llanitedave" wrote: > > On Wednesday, May 22, 2013 7:24:15 AM UTC-7, Chris Angelico wrote: > > On Wed, May 22, 2013 at 11:42 PM, Wolfgang Keller wrote: ... > > there's another option that is available to every platform and > > (practially) every high level language: the web

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
On Thu, May 23, 2013 at 2:47 PM, Steven D'Aprano wrote: > But all joking aside, eval is dangerous, yes, but it is not "evil". It > needs to be handled with caution, but there are good uses for it. In > fact, there are a few -- a very few -- things which can *only* be done > with eval or exec. That

RE: Modules list-tool

2013-05-22 Thread Carlos Nepomuceno
Have you tried Inspect Shell[1]? All you have to do to monitor your script is include "import inspect_shell" in the 1st line of you source code and then run: "python inspect_shell.py" When you get the prompt you can enter the following to show the list of modules: localhost:1234> '\n'.join(['{

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Steven D'Aprano
On Wed, 22 May 2013 22:31:04 +, Alister wrote: > Please write out 1000 time (without using any form of loop) > > "NEVER use input in python <3.0 it is EVIL"* > > as Chris A point out it executes user input an can cause major damage > (reformatting the hard disk is not impossible!) Is he all

Re: Modules list-tool

2013-05-22 Thread Dan Stromberg
On Tue, May 21, 2013 at 12:35 PM, Gisle Vanem wrote: > Are anyone aware of a tool that can show me at run-time > which modules (pyd/dll) are loaded into a Python program at a specific > time (or over time)? > > To clarify, e.g. when running a sample from PyQt4 > (examples\tutorials\**addressbook\

Ordered dictionaries compared

2013-05-22 Thread Dan Stromberg
What kind of ordered dictionaries? Sorted by key. I've redone the previous comparison, this time with a better red-black tree implementation courtesy of Duncan G. Smith. The comparison is at http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/just-trees/ The Red-Black tree g

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
The last line of my noob piece can be improved. So this is it: ### 1strow_average.py ### #Assuming you have CSV (comma separated values) files such as: #1.txt = '0,1,2,3,4,5,6,7,8,9\n' \ #    '10,11,12,13,14,15,16,17,18,19\n' \ #    '20,21,22,23,24,25,26,27,28,29\n' ... # # Usage: contents

Re: Future standard GUI library

2013-05-22 Thread llanitedave
On Wednesday, May 22, 2013 7:24:15 AM UTC-7, Chris Angelico wrote: > On Wed, May 22, 2013 at 11:42 PM, Wolfgang Keller wrote: > > > What other open-source cross-platform programming language choices do yo > > > have. > > > > > > Java? For GUIs? Excuse me while I vomit. > > > > > > C++? As a

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Kevin Xi
Oh yes, you guys are right. Thank you very much for warning me that. On Thursday, May 23, 2013 6:31:04 AM UTC+8, Alister wrote: > > as Chris A point out it executes user input an can cause major damage > > (reformatting the hard disk is not impossible!) > It definitely can cause major damage

Re: A computer programmer, web developer and network admin resume

2013-05-22 Thread Ken Bolton
On Wed, May 22, 2013 at 7:25 PM, Gregory Ewing wrote: > Tim Chase wrote: > >> So a pirate programmer walks into a bar with a bird on his shoulder. >> The bird repeatedly squawks "pieces of nine! pieces of nine!". The >> bartender looks at him and asks "what's up with the bird?" to which >> the pi

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> From: oscar.j.benja...@gmail.com > Date: Thu, 23 May 2013 01:30:53 +0100 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: carlosnepomuc...@outlook.com > CC: prueba...@latinmail.com; python-list@python.org > > On 22 May 2013 23:31, Car

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
> From: oscar.j.benja...@gmail.com > Date: Thu, 23 May 2013 01:34:37 +0100 > Subject: Re: file I/O and arithmetic calculation > To: carlosnepomuc...@outlook.com > CC: python-list@python.org > > On 23 May 2013 00:49, Carlos Nepomuceno wrote: >> >> The code i

Re: file I/O and arithmetic calculation

2013-05-22 Thread Oscar Benjamin
On 23 May 2013 00:49, Carlos Nepomuceno wrote: > > The code is pretty obvious to me, I mean there's no obfuscation at all. I honestly can't tell if you're joking. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Oscar Benjamin
On 22 May 2013 23:31, Carlos Nepomuceno wrote: > > I still don't understand why % benefits from literals optimization > ("'%d'%12345") while '{:d}'.format(12345) doesn't. There's no reason why that optimisation can't happen in principle. However no one has written a patch for it. Why don't you l

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
> From: denismfmcma...@gmail.com [...] > > import re > def v(s): > l=len(s) > t=0. > for i in range(l): > t=t+(abs(ord(s[i]))*1.) > return t/(l*1.) > for n in range(5): > m="c:/test/"+str(n+1)+".txt" > f=open(m,"r") > d=[] > t=0. > for l in range(10): > d=d+

Re: file I/O and arithmetic calculation

2013-05-22 Thread Denis McMahon
On Thu, 23 May 2013 01:13:19 +0900, Keira Wilson wrote: > I would appreciate if someone could write a simple python code for the > purpose below: Didn't have your data, so couldn't verify it completely, but try this: import re def v(s): l=len(s) t=0. for i in range(l): t=t+(abs(ord(s[i]))*1

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
># contents[3][4][5] : 6th column of 5th row of file '4.txt' BTW, it should read # contents[3][4][5] : 6th value of 5th row of file '4.txt' -- http://mail.python.org/mailman/listinfo/python-list

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
> From: oscar.j.benja...@gmail.com [...] > > Do you find this code easy to read? I wouldn't write something like > this and I certainly wouldn't use it when explaining something to a > beginner. > > Rather than repeated list comprehensions you should conside

Re: file I/O and arithmetic calculation

2013-05-22 Thread Oscar Benjamin
On 22 May 2013 22:05, Carlos Nepomuceno wrote: > > filenames = ['1.txt', '2.txt', '3.txt', '4.txt', '5.txt'] > contents = [[[int(z) for z in y.split(',')] for y in open(x).read().split()] > for x in filenames] > s1c = [sum([r[0] for r in f]) for f in contents] > a1r = [sum(f[0])/float(len(f[0]

Re: A computer programmer, web developer and network admin resume

2013-05-22 Thread Gregory Ewing
Tim Chase wrote: So a pirate programmer walks into a bar with a bird on his shoulder. The bird repeatedly squawks "pieces of nine! pieces of nine!". The bartender looks at him and asks "what's up with the bird?" to which the pirate says "Arrr, he's got a parroty error." No, he's just using hal

RE: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Carlos Nepomuceno
> From: alister.w...@ntlworld.com [...] > Kevin > > Please write out 1000 time (without using any form of loop) > > "NEVER use input in python <3.0 it is EVIL"* > > as Chris A point out it executes user input an can cause major damage > (reformatting the har

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Alister
On Tue, 21 May 2013 23:52:30 -0700, Kevin Xi wrote: > On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: >> Hi, >> > Hi, >> >> I'm just starting out with Python and to practice I am trying to write >> a script that can have a simple conversation with the user. >> > So you may

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> Date: Wed, 22 May 2013 13:26:23 -0700 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > From: prueba...@latinmail.com > To: python-list@python.org [...] > > Maybe a cformat(formatstring, variables) function should be created > in the strin

Re: subclassing from unittest

2013-05-22 Thread Terry Jan Reedy
On 5/22/2013 11:32 AM, Charles Smith wrote: Have you red this? I will suggest some specifics. http://www.catb.org/esr/faqs/smart-questions.html I'd like to subclass from unittest.TestCase. What version of Python. > I observed something interesting and wonder if anyone can explain what's goi

RE: file I/O and arithmetic calculation

2013-05-22 Thread Carlos Nepomuceno
Funny! I made a lot of assumptions regarding your requirements specification. Let me know if it isn't what you need: ### 1strow_average.py ### #Assuming you have CSV (comma separated values) files such as: #1.txt = '0,1,2,3,4,5,6,7,8,9\n' \ #    '10,11,12,13,14,15,16,17,18,19\n' \ #    '2

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread nn
On May 22, 2:30 pm, Ned Batchelder wrote: > On 5/22/2013 10:58 AM, Steven D'Aprano wrote: > > > On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: > > >> I didn't mean to create a tempest in a teapot.  I was away from > >> comp.lang.python, python-bugs, and python-dev for a few years.  In >

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Grant Edwards
On 2013-05-22, Jorgen Grahn wrote: > On Wed, 2013-05-22, Dave Angel wrote: >> On 05/22/2013 04:46 AM, loial wrote: >>> >>> >>> Is there any additional traceing I can do(either within my >>> python code or on the network) to establish what is causing this >>> error? >> >> Try using Wiresha

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Jorgen Grahn
On Wed, 2013-05-22, Matt Jones wrote: > On Wed, May 22, 2013 at 3:46 AM, loial wrote: > >> I have a sockets client that is connecting to a printer and occassionally >> getting the error "104 Connection reset by peer" >> >> I have not been able to diagnose what is causing this. Is there any >> addi

Re: What was the project that made you feel skilled in Python?

2013-05-22 Thread Terry Jan Reedy
On 5/22/2013 9:05 AM, Ben Finney wrote: I wanted to simulate a particular board game, and had others in mind with some common mechanics. This resulted in a library for rolling dice in different combinations, and looking up result tables https://pypi.python.org/pypi/alea>. Have you cosidered a

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-22 Thread nn
On May 22, 6:35 am, Skip Montanaro wrote: > >> Is this tutorial outdated or this still an issue? > > >> [1] > >>http://docs.python.org/2/tutorial/inputoutput.html#old-string-formatting > > > That tutorial is out of date.  %-formatting isn't being removed. > > OTOH, PEP 3101 also mentions deprecati

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Jorgen Grahn
On Wed, 2013-05-22, Dave Angel wrote: > On 05/22/2013 04:46 AM, loial wrote: >> >> >> Is there any additional traceing I can do(either within my >> python code or on the network) to establish what is causing this >> error? > > Try using Wireshark. It can do a remarkable job of filtering,

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-22 Thread Terry Jan Reedy
On 5/22/2013 10:24 AM, Denis McMahon wrote: Indeed, removing %-formatting could break a substantial amount of live code, with potentially significant maintenance effort in the user While I would like to see % formatting go away everntually*, other developers would not. In any case, I agree th

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Ned Batchelder
On 5/22/2013 10:58 AM, Steven D'Aprano wrote: On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: I didn't mean to create a tempest in a teapot. I was away from comp.lang.python, python-bugs, and python-dev for a few years. In particular, I didn't ever see the aforementioned thread fro

Re: file I/O and arithmetic calculation

2013-05-22 Thread Mark Lawrence
On 22/05/2013 17:13, Keira Wilson wrote: Dear all, I would appreciate if someone could write a simple python code for the purpose below: I have five text files each of 10 columns by 10 rows as follows: |file_one= 'C:/test/1.txt' file_two= 'C:/test/2.txt' . . . file_five= 'C:/test/5.txt'|

file I/O and arithmetic calculation

2013-05-22 Thread Keira Wilson
Dear all, I would appreciate if someone could write a simple python code for the purpose below: I have five text files each of 10 columns by 10 rows as follows: file_one = 'C:/test/1.txt' file_two = 'C:/test/2.txt' . . . file_five = 'C:/test/5.txt' I want to calculate the mean of first row (10

Re: subclassing from unittest

2013-05-22 Thread Charles Smith
On 22 Mai, 17:32, Charles Smith wrote: > Hi, > > I'd like to subclass from unittest.TestCase.  I observed something > interesting and wonder if anyone can explain what's going on... some > subclasses create  null tests. > > I can create this subclass and the test works: > >   class StdTestCase (un

subclassing from unittest

2013-05-22 Thread Charles Smith
Hi, I'd like to subclass from unittest.TestCase. I observed something interesting and wonder if anyone can explain what's going on... some subclasses create null tests. I can create this subclass and the test works: class StdTestCase (unittest.TestCase): blahblah and I can create this

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Steven D'Aprano
On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: > I didn't mean to create a tempest in a teapot. I was away from > comp.lang.python, python-bugs, and python-dev for a few years. In > particular, I didn't ever see the aforementioned thread from Feb 2012. > Had I known of that thread I

Re: What was the project that made you feel skilled in Python?

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 11:05 PM, Ben Finney wrote: > I wanted to simulate a particular board game, and had others in mind > with some common mechanics. > > This resulted in a library for rolling dice in different combinations, > and looking up result tables https://pypi.python.org/pypi/alea>. Fu

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-22 Thread Denis McMahon
On Tue, 21 May 2013 23:26:58 -0400, Ned Batchelder wrote: > On 5/21/2013 10:26 PM, Carlos Nepomuceno wrote: >> "Since str.format() is quite new, a lot of Python code still uses the % >> operator. However, because this old style of formatting will eventually >> be removed from the language, str.fo

Re: Translation API in Python

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 8:16 AM, Hala Gamal wrote: > ok MR, > I have searched before asking here,but i didn't find thing Your post doesn't demonstrate that. When you ask a question like this, it's helpful to give at least some indication of what you've tried and what you haven't. Also, I strongly

Re: Future standard GUI library

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 11:42 PM, Wolfgang Keller wrote: > What other open-source cross-platform programming language choices do yo > have. > > Java? For GUIs? Excuse me while I vomit. > > C++? As a language for human beings? Oops, I have to throw up again. I personally like using Pike and GTK, s

Re: Future standard GUI library

2013-05-22 Thread Wolfgang Keller
> I know this may sound a silly question because no one can see the > future. But ... > Do you think tkinter is going to be the standard python built-in gui > solution as long as python exists? "Standard built-in" maybe, but by far most people who need a GUI for an actual application will keep usi

Re: Future standard GUI library

2013-05-22 Thread Wolfgang Keller
> Do you think tkinter is going to be the standard python built-in > gui solution as long as python exists? > >>> > >>> AT the moment, there is nothing really comparable that is a > >>> realistic candidate to replace tkinter. > >> > >> FLTK? (http://www.fltk.org/index.php) > > > > tkinter

Re: A computer programmer, web developer and network admin resume

2013-05-22 Thread Harry Percival
oh wow. great one, thanks for that tim :) On 22 May 2013 14:03, Tim Chase wrote: > On 2013-05-22 16:39, Chris Angelico wrote: > > On Wed, May 22, 2013 at 12:32 PM, Tim Chase > > wrote: > > > On 2013-05-22 01:15, i...@databaseprograms.biz wrote: > > >> A computer programmer, web developer

Re: What was the project that made you feel skilled in Python?

2013-05-22 Thread Ben Finney
Ned Batchelder writes: > as you moved from exercises like those in Learn Python the Hard Way, > up to your own self-guided work on small projects, what project were > you working on that made you feel independent and skilled? What > program first felt like your own work rather than an exercise t

Re: A computer programmer, web developer and network admin resume

2013-05-22 Thread Tim Chase
On 2013-05-22 16:39, Chris Angelico wrote: > On Wed, May 22, 2013 at 12:32 PM, Tim Chase > wrote: > > On 2013-05-22 01:15, i...@databaseprograms.biz wrote: > >> A computer programmer, web developer and network administrator > > > > ...walk into a bar... > > > > So what's the punchline? > > ;steps

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Dave Angel
On 05/22/2013 04:46 AM, loial wrote: Is there any additional traceing I can do(either within my python code or on the network) to establish what is causing this error? Try using Wireshark. It can do a remarkable job of filtering, capturing, and analyzing packets. It can also rea

Re: Python Windows release and encoding

2013-05-22 Thread Peter Otten
Absalom K. wrote: > Hi, I am working on Linux; a friend of mine sends to me python files from > his Windows release. He uses the editor coming with the release; he runs > his code from the editor by using a menu (or some F5 key I think). > > He doesn't declare any encoding in his source file; whe

Python Windows release and encoding

2013-05-22 Thread Absalom K.
Hi, I am working on Linux; a friend of mine sends to me python files from his Windows release. He uses the editor coming with the release; he runs his code from the editor by using a menu (or some F5 key I think). He doesn't declare any encoding in his source file; when I want to try his code, I h

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> Date: Wed, 22 May 2013 07:25:13 -0400 > From: n...@nedbatchelder.com [...] > You have to keep in mind that 2.7 is not getting any new features, no > matter how small they seem. If you create a patch that implements the > comma flag in %-formatting, it *mig

Re: Diagnosing socket "Connection reset by peer"

2013-05-22 Thread Matt Jones
This typically indicates that the "peer" at the other end of the tcp connection severed the session without the typical FIN packet. If you're treating the printer as a "blackbox" then there really isn't anything you can do here except catch the exception and attempt to reconnect. *Matt Jones* O

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Ned Batchelder
On 5/21/2013 11:38 PM, Carlos Nepomuceno wrote: From:steve+comp.lang.pyt...@pearwood.info >Subject: Re: PEP 378: Format Specifier for Thousands Separator >Date: Wed, 22 May 2013 03:08:54 + >To:python-list@python.org [...] >>So, the only alternative to have "'%,d' % x" rendering the thousan

Re: Static Maps from Lat Long data in XLS file

2013-05-22 Thread kobewka
Thanks Ken. I'll have a closer look at those links. I also found Motionless, which creates a static map HTML file. Combined with what you said, I should be able to get what I need. https://github.com/ryancox/motionless Scott On Tuesday, May 21, 2013 9:58:25 AM UTC-4, Ken Bolton wrote: > On T

Re: Static Maps from Lat Long data in XLS file

2013-05-22 Thread kobewka
On Tuesday, May 21, 2013 11:27:42 AM UTC-4, Tim Daneliuk wrote: > On 05/21/2013 08:12 AM, @gmail.com wrote: > > > Hello, > > > > > > I'm new to Python, but I think it can solve my problem and I am looking for > > a someone to point me to tutorial or give me some tips here. > > > > > > I have

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Skip Montanaro
Please stop perpetuating this myth, see http://mail.python.org/pipermail/python-dev/2012-February/116789.html and http://bugs.python.org/issue14123 >>> What myth? >> >> The myth that % string formatting is deprecated. It is not deprecated. > Skip didn't say that it was deprecate

Re: Myth Busters: % "this old style of formatting will eventually be removed from the language"

2013-05-22 Thread Skip Montanaro
>> Is this tutorial outdated or this still an issue? >> >> [1] >> http://docs.python.org/2/tutorial/inputoutput.html#old-string-formatting > > > That tutorial is out of date. %-formatting isn't being removed. OTOH, PEP 3101 also mentions deprecation, at the very end: "... both systems can co-exis

Re: More general way of generating PyODBC queries as a dict?

2013-05-22 Thread stackoverflowuser95
On Wednesday, May 22, 2013 9:33:18 AM UTC+10, Dennis Lee Bieber wrote: > On Tue, 21 May 2013 10:27:07 -0700 (PDT), stackoverflowuse...@gmail.com > > declaimed the following in gmane.comp.python.general: > > > > > > > > For example, when multiple tables are queried; some hackish lambdas are >

Diagnosing socket "Connection reset by peer"

2013-05-22 Thread loial
I have a sockets client that is connecting to a printer and occassionally getting the error "104 Connection reset by peer" I have not been able to diagnose what is causing this. Is there any additional traceing I can do(either within my python code or on the network) to establish what is causin

Re: Newbie question about evaluating raw_input() responses

2013-05-22 Thread Chris Angelico
On Wed, May 22, 2013 at 4:52 PM, Kevin Xi wrote: > On Wednesday, May 22, 2013 2:23:15 PM UTC+8, C. N. Desrosiers wrote: >> age=raw_input('Enter your age: ') >> if age > 18: > > You can either use `raw_input` to read data and convert it to right type, or > use `input` to get an integer directly. R

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午11時38分45秒寫道: > > > From: steve+comp.lang.pyt...@pearwood.info > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > Date: Wed, 22 May 2013 03:08:54 + > > To: python-list@python.org > [...] > >> So,