Re: Creating a dictionary from a .txt file

2013-03-31 Thread Terry Jan Reedy
On 3/31/2013 11:52 AM, C.T. wrote: Hello, I'm currently working on a homework problem that requires me to create a dictionary from a .txt file that contains some of the worst cars ever made. The file looks something like this: 1958 MGA Twin Cam 1958 Zunndapp Janus 1961 Amphicar 1961 Corvair

Re: collections.Iterator __subclasshook__ does not check if next() is callable

2013-03-31 Thread Terry Jan Reedy
Who's job is it to check if `next` (and technically `__iter__`) are methods? The programmer, and a user who does not trust the competence of the programmer. But this is the least of the possible errors. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Python subdomains https

2013-04-02 Thread Terry Jan Reedy
On 4/2/2013 7:05 AM, Jakub Muszynski wrote: Hi, I need to add python.org http://python.org https to my company firewall policy, but I'm not allowed to add rule for https://*.python.org http://python.org subdomains. Can You give me/publish list of important subdomains (like

Re: Performance of int/long in Python 3

2013-04-02 Thread Terry Jan Reedy
unicode'. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Python subdomains https

2013-04-02 Thread Terry Jan Reedy
On 4/2/2013 12:52 PM, Terry Jan Reedy wrote: On 4/2/2013 7:05 AM, Jakub Muszynski wrote: Hi, I need to add python.org http://python.org https to my company firewall policy, but I'm not allowed to add rule for https://*.python.org http://python.org subdomains. Can You give me/publish list

Re: Performance of int/long in Python 3

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 1:32 AM, Steven D'Aprano wrote: On Wed, 03 Apr 2013 14:31:03 +1100, Neil Hodgson wrote: Sorting a million string list (all the file paths on a particular computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so we're out of the 'not noticeable by humans' range.

Re: Python install Win 7 Problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 1:51 PM, Martin Schöön wrote: On 2013-04-02, balasubramanian Achuthan balasu...@gmail.com wrote: Try using Activestate python. The free version would suffice your needs and it comes with a clean install. I have been travelling and have not had time to read this thread in detail so

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 12:24 PM, Joe Hill wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: I attempted to print about 10 pages of documentation from the help files using IDLE. On all the pages the side of each page was missing about 1/4 inch of text. You neglected to say what you actually did to have a

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 2:50 PM, Joe Hill wrote: On Wed, 03 Apr 2013 14:40:38 -0400, Terry Jan Reedy tjre...@udel.edu wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: I attempted to print about 10 pages of documentation from the help files using IDLE. On all the pages the side of each page was missing

Re: Time zone changing while Win app is running

2013-04-03 Thread Terry Jan Reedy
on the issue, passing a tz arg to now() will give the answer for any timezone on earth. A user-friendly app displaying times should let users choose. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 5:16 PM, Joe Hill wrote: On Wed, 03 Apr 2013 16:20:20 -0400, Terry Jan Reedy tjre...@udel.edu wrote: On 4/3/2013 2:50 PM, Joe Hill wrote: On Wed, 03 Apr 2013 14:40:38 -0400, Terry Jan Reedy tjre...@udel.edu wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: I attempted to print

Windows printing problem (was re; IDLE printing problem_

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 6:26 PM, Joe Hill wrote: In light of the fact that this is a new problem and has only occurred in Python - I shall just regard that as either a feature or flaw... Based on what you have said, the problem IS NOT OCCURRING IN PYTHON. It is occurring in the Microsoft HTML help

Re: Data storage Py 3.3

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 6:53 PM, Irmen de Jong wrote: On 4-4-2013 0:33, Joe Hill wrote: IDLE wants to use Python33 as the data storage folder - with exe files etc. Typically the 'default data storage' is in 'last used' directory or most programs even have a browse setting that one can quickly set and

Re: problem in running a basic code in python 3.3.0 that includes HTML file

2013-04-04 Thread Terry Jan Reedy
type=checkbox name=tornado value=tornadotornadobr input type=checkbox name=landslide value=landslidelandslidebr input type=checkbox name=downburst value=downburstdownburstbr /form input type=submit value=Submit /body /html ''') -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python

Re: How do I tell if I'm running under IDLE?

2013-04-06 Thread Terry Jan Reedy
. Ideally, I'd like to detect any arbitrary environment such as Spyder, IPython, BPython, etc., but will settle for just IDLE. I expect that looking as sys.stdin in someway should work for all. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: The usage of -m option of python

2013-04-08 Thread Terry Jan Reedy
On 4/8/2013 10:50 AM, Albert van der Horst wrote: In article mailman.3484.1363662214.2939.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 3/18/2013 5:17 PM, Peng Yu wrote: Hi, I don't quite understand how -m option is used. And it is difficult to search for -m in google. Could

Re: Interactive development in Python à la Smalltalk?

2013-04-08 Thread Terry Jan Reedy
. Idle also has a debugger window that does some of that, though it works better on non-Windows OSes. I have never actually used it. --- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Python module vs library

2013-04-09 Thread Terry Jan Reedy
On 4/9/2013 5:58 AM, k.lykour...@gmail.com wrote: Hi, what is the difference between python module and library ? They are in different categories. A Python module is a namespace (a mapping of names to objects) created by running Python code as a main module or by import statements within

Re: newbie question about confusing exception handling in urllib

2013-04-09 Thread Terry Jan Reedy
)): -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Terry Jan Reedy
On 4/12/2013 3:32 AM, Chris Angelico wrote: On Fri, Apr 12, 2013 at 4:25 PM, Rob Schneider rmsc...@gmail.com wrote: The close method is defined and flushing and closing a file, so it should not return until that's done. What command are you using to create the temp file? re command to

Re: name lookup failure using metaclasses with unittests

2013-04-12 Thread Terry Jan Reedy
On 4/12/2013 3:17 AM, Ulrich Eckhardt wrote: Am 11.04.2013 10:19, schrieb Steven D'Aprano: if sys.version = '3': Use sys.version_info = (3,), otherwise your code breaks when upgrading to Python 10 and greater. ;^) The second question that came up was if there is a way to keep a metaclass

Re: SimpleHTTPRequestHandler used with HTTP/1.1 hangs after the second resource on a page.

2013-04-12 Thread Terry Jan Reedy
On 4/12/2013 4:46 PM, Piotr Dobrogost wrote: Hi! I'd like to bring your attention to the question titled Use HTTP/1.1 with SimpleHTTPRequestHandler at http://stackoverflow.com/q/15839718/95735 which reads; When I use I find the doc slightly confusing. The SO code uses BaseHTTPServer. The doc

Re: API design for Python 2 / 3 compatibility

2013-04-13 Thread Terry Jan Reedy
On 4/13/2013 12:36 PM, Stefan Schwarzer wrote: Hello, I'm currently changing the FTP client library ftputil [1] so that the same code of the library works with Python 2 (2.6 and up) and Python 3. (At the moment the code is for Python 2 only.) I've run into a API design issue where I don't know

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-14 Thread Terry Jan Reedy
is the syntax. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Cross-compiling Python for ARM?

2013-04-15 Thread Terry Jan Reedy
On 4/15/2013 11:20 AM, Gilles wrote: Hello I tried running uWSGI on an ARM-based appliance, but it fails. Apparently, it could be due to the official Python 2.6.6 interpreter in the depot not being compiled the way uWSGI expects it to be: ./configure --enable-shared; make; make install;

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-15 Thread Terry Jan Reedy
On 4/15/2013 1:43 PM, Antoon Pardon wrote: $ python3 Python 3.2.3 (default, Feb 20 2013, 17:02:41) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. class vslice (slice): ... pass ... Traceback (most recent call last): File stdin, line 1, in module

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-15 Thread Terry Jan Reedy
On 4/15/2013 10:32 PM, Steven D'Aprano wrote: On Mon, 15 Apr 2013 20:52:58 -0400, Terry Jan Reedy wrote: Some builtin classes cannot be subclassed. There is an issue to document which better. That does not mean that it is not a class. I think it is also important to document whether

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-16 Thread Terry Jan Reedy
On 4/16/2013 5:07 AM, Antoon Pardon wrote: Op 16-04-13 05:17, Terry Jan Reedy schreef: On 4/15/2013 10:32 PM, Steven D'Aprano wrote: On Mon, 15 Apr 2013 20:52:58 -0400, Terry Jan Reedy wrote: I will keep the above in mind if I write or review a patch. here are 4 non-subclassable builtin

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-16 Thread Terry Jan Reedy
On 4/16/2013 10:30 AM, rosoloum wrote: I do not have admin rights on my machine The answer to your question may depend on the OS (linux), distribution (many), and version. What about `_tkinter` and `dl`? How can I have them ready for the Python installer? Building _tkinter (a Python

Re: a couple of things I don't understand wrt lists

2013-04-16 Thread Terry Jan Reedy
On 4/16/2013 11:37 AM, aaB wrote: I represent the CA's rule with a list of integers, of value 1 or 0. Here is the function I use to generate the list: def get_rule(rulenum): rule = [] while rulenum 0: rule.append(rulenume % 2) rulenum /= 2 divmod(rulenum) will return both

Re: The node.js Community is Quietly Changing the Face of Open Source

2013-04-16 Thread Terry Jan Reedy
-is-quietly-changing-the-face-of-open-source/ The irony is that the author goes on to say that the node.js community 'works' because they all use the same infrastructure battery: git and git-hub ;-). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: The type/object distinction and possible synthesis of OOP and imperative programming languages

2013-04-16 Thread Terry Jan Reedy
On 4/16/2013 1:29 PM, Ethan Furman wrote: On 04/16/2013 01:25 AM, Serhiy Storchaka wrote: On 16.04.13 07:46, Ian Kelly wrote: On Mon, Apr 15, 2013 at 9:17 PM, Terry Jan Reedy tjre...@udel.edu wrote: I will keep the above in mind if I write or review a patch. here are 4 non-subclassable

Re: Missing decimals in the code - some suggestions?

2013-04-16 Thread Terry Jan Reedy
On 4/16/2013 2:02 PM, hmjelte...@gmail.com wrote: Hi! I am using ystockquote with the following code: def get_historical_prices(symbol, start_date, end_date): Get historical prices for the given ticker symbol. Date format is 'MMDD' Returns a nested list.

Re: Understanding Boolean Expressions

2013-04-16 Thread Terry Jan Reedy
). The second. Then the or_test on the left also maps to an and_test. Each and_test eventually resolves to 'identifier', specifically 'x' and 'y'. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread Terry Jan Reedy
On 4/18/2013 12:24 PM, James Jong wrote: After compiling, you might want to run the test suite. libtk8.6.so http://libtk8.6.so I do not know that Python/_tkinter/tkinter has been very well tested, certainly not on all systems, with the newish tcl/tk 8.6, as opposed to 8.5.z used for

Re: Feature Request: `operator.not_in`

2013-04-19 Thread Terry Jan Reedy
to return true/false. object.__contains__(self, item) Called to implement membership test operators. Should return true if item is in self, false otherwise -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Ubuntu package python3 does not include tkinter

2013-04-19 Thread Terry Jan Reedy
On 4/19/2013 1:17 PM, lcrocker wrote: Am I mistaken in my belief that tkinter is a non-optional part of the Python language? Yes. The PSF CPython Windows installer makes installation of tcl/tk/tkinter optional. The build files will compile and build Python without tkinter and without other

Re: Include and lib files for Visual Studio?

2013-04-20 Thread Terry Jan Reedy
On 4/20/2013 4:59 PM, xuc...@gmail.com wrote: I am looking for the Python include and lib files for windows. I have a c++ project that I am importing into Visual Studio 2010 (express) and it links python. I need the include and lib files for windows. Where can I get them? I'd like to use

Re: There must be a better way

2013-04-20 Thread Terry Jan Reedy
On 4/20/2013 8:34 PM, Tim Chase wrote: In 2.x, the csv.reader() class (and csv.DictReader() class) offered a .next() method that is absent in 3.x In Py 3, .next was renamed to .__next__ for *all* iterators. The intention is that one iterate with for item in iterable or use builtin functions

Re: Is Unicode support so hard...

2013-04-21 Thread Terry Jan Reedy
On 4/20/2013 9:37 PM, rusi wrote: I believe that the recent correction in unicode performance followed jmf's grumbles No, the correction followed upon his accurate report of a regression, last August, which was unfortunately mixed in with grumbles and inaccurate claims. Others separated out

Re: suggestion for a small addition to the Python 3 list class

2013-04-21 Thread Terry Jan Reedy
On 4/21/2013 1:12 PM, Lele Gaifax wrote: Robert Yacobellis ryacobel...@luc.edu writes: I've noticed that the str join() method takes an iterable, Specifically, it takes an iterable of strings. Any iterable can be made such iwth map(str, iterable) or map(repr, iterble). so in the most

Re: List Count

2013-04-23 Thread Terry Jan Reedy
be implemented for non-sequence collections, such as a Tree class, that allow multiple occurrences of an item. whereas count for other objects (e.g. strings) has these. Strings (of unicode or bytes) are exceptional in multiple ways. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo

Re: List Count

2013-04-23 Thread Terry Jan Reedy
On 4/23/2013 12:57 PM, Blind Anagram wrote: So, all I was doing in asking for advice was to check whether there is an easy way of avoiding the slice copy, And there is. not because this is critical, but rather because it is a pity to limit the performance because Python forces a (strictly

Re: Nested iteration?

2013-04-23 Thread Terry Jan Reedy
could terminate without exhausting the iterator and I wanted the outer loop to then resume. __ Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: My gui

2013-04-24 Thread Terry Jan Reedy
On 4/24/2013 1:53 PM, Chris “Kwpolska” Warrick wrote: Please try fixing it and running it _outside of IDLE_, which is also built in Tk The default mode of Idle runs user code in a separate process. Editing tkinter code with Idle and running it (in the separate process) should be no problem.

Re: Libroffice PMT equivalent in python

2013-04-25 Thread Terry Jan Reedy
On 4/25/2013 6:46 AM, ஆமாச்சு wrote: Hi, Are there equivalent in any Python libraries that could match function like PMT in libreoffice? Refer: https://help.libreoffice.org/Calc/Financial_Functions_Part_Two#PMT try the packages listed at

Re: Nested For loop not running full

2013-04-26 Thread Terry Jan Reedy
On 4/26/2013 4:48 AM, inshu chauhan wrote: Hello everyone, I have this part of my code where I am trying to traverse over an image by running a for loop for both x and y co-ordinate axis. But the loop is terminating by just reading first pixel. Can think of a reason why this is happening ?

Re: Comparison Style

2013-04-27 Thread Terry Jan Reedy
On 4/27/2013 5:03 PM, Roy Smith wrote: In article mailman.1077.1366944517.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: If you switch the order of operands in that, the compiler won't help you. Plus it reads wrong. So the convention is still variable==constant. I just

Re: python.exe has stopped working when os.execl() runs on Windows 7

2013-04-28 Thread Terry Jan Reedy
On 4/27/2013 11:42 PM, cormog...@gmail.com wrote: Is there the place to open a ticket for Python developers? bugs.python.org -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Terry Jan Reedy
On 4/29/2013 5:47 AM, c...@isbd.net wrote: case). Here's the traceback:- File /usr/local/lib/python2.7/dist-packages/gallery/picture.py, line 361, in createPictureHTML file.write(.join(html).encode('utf-8')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783:

Re: to a human - about 2to3

2013-05-01 Thread Terry Jan Reedy
On 5/1/2013 10:52 AM, Jennifer Butler wrote: I will start teaching Python to my pupils shortly. I have been looking for materials and have gathered a collection of programs. The problem is they are written in v2 and I have v3 installed in my classroom. I read about the 2to3 conversion program,

Re: (Learner-here) Lists + Functions = headache

2013-05-05 Thread Terry Jan Reedy
that by testings. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: First python program, syntax error in while loop

2013-05-06 Thread Terry Jan Reedy
On 5/6/2013 11:31 AM, Roy Smith wrote: In article mailman.1361.1367847484.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, May 6, 2013 at 11:08 PM, Roy Smith r...@panix.com wrote: On the other hand, I've long since given up trying to remember operator precedence in

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Terry Jan Reedy
On 5/7/2013 9:22 AM, jmfauth road forth on his dead hobbyhorse to hijack yet another thread: # Py 3.3 ascii and non ascii chars timeit.repeat(a = 'hundred'; 'x' in a) [0.11426985953005442, 0.10040049292649655, 0.09920834808588097] timeit.repeat(a = 'maçãé€ẞ'; 'é' in a) [0.2345595188256766,

Re: Get filename using filefialog.askfilename

2013-05-07 Thread Terry Jan Reedy
look in the io chapter or use dir() and help() as John G. suggested. Python programmers should really learn to use dir(), help(), and the manuls, including the index and module index. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Making safe file names

2013-05-07 Thread Terry Jan Reedy
On 5/7/2013 3:58 PM, Andrew Berg wrote: Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However, artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forward

Re: cello library

2013-05-08 Thread Terry Jan Reedy
. */ with (file in open($(File, NULL), prices.bin, wb))) { ... } An interesting question is whether it could be used to convert or rewrite Python to C. __ Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Terry Jan Reedy
On 5/9/2013 1:23 AM, Steven D'Aprano wrote: Besides, this is not to denigrate the idea of a read() function that takes a filename and returns its contents. But that is not an object constructor. It may construct a file object internally, but it doesn't return the file object, so it is

Re: Forming a small python programming group

2013-05-09 Thread Terry Jan Reedy
On 5/9/2013 2:59 AM, kreta06 wrote: Hi All, I'm looking for one or two medium-advanced python programmers to practice programming on a Windows 7 platform. In addition, any interests in writing python code to query Microsoft SQL databases (2005-2008) is also welcomed. I've coded in python 2.7

Re: Old version docs don't link to current version

2013-05-12 Thread Terry Jan Reedy
On 5/12/2013 10:12 AM, Chris Angelico wrote: Not sure if this is an oversight or something deliberate... could be either. From http://docs.python.org/3.0/library/http.server.html there's no link to the current docs, even though from http://docs.python.org/3/library/http.server.html it's

Re: object.enable() anti-pattern

2013-05-12 Thread Terry Jan Reedy
On 5/12/2013 1:14 PM, Wayne Werner wrote: On Fri, 10 May 2013, Gregory Ewing wrote: Wayne Werner wrote: You don't ever want a class that has functions that need to be called in a certain order to *not* crash. That seems like an overly broad statement. What do you think the following should

Re: object.enable() anti-pattern

2013-05-12 Thread Terry Jan Reedy
the class. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Message passing syntax for objects | OOPv2

2013-05-12 Thread Terry Jan Reedy
On 5/12/2013 1:18 PM, Ned Batchelder wrote: On 5/8/2013 10:39 PM, Mark Janssen wrote: ...The field needs re-invented and re-centered.[...] For anyone who want to be involved. See the wikiwikiweb -- a tool that every programmer should know and use -- and these pages: ComputerScienceVersionTwo

Re: Fwd: Python for philosophers

2013-05-14 Thread Terry Jan Reedy
2013/5/14 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info mailto:steve+comp.lang.pyt...@pearwood.info Python is not named after the snake, but after Monty Python the British comedy troupe. And they picked their name because it sounded funny. That does not mean they were

Re: Writing a blog post on the new Enum.

2013-05-14 Thread Terry Jan Reedy
On 5/14/2013 3:52 AM, Chris Angelico wrote: On Tue, May 14, 2013 at 9:40 AM, Fábio Santos fabiosantos...@gmail.com wrote: http://fabiosantoscode.blogspot.pt/2013/05/pythons-new-enum-class.html class Text(unicode, Enum): one = u'one' two = u'two' three =

Re: Python for philosophers

2013-05-15 Thread Terry Jan Reedy
On 5/15/2013 9:17 PM, Tim Daneliuk wrote: http://pvspade.com/Sartre/cookbook.html Wikedly funny. -- http://mail.python.org/mailman/listinfo/python-list

Re: python script is not running

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 6:12 AM, Avnesh Shakya wrote: hi, i want to run python script which generating data into json fromat, I am using crontab, but it's not executing... my python code-- try.py -- import json import simplejson as json import sys def tryJson(): saved = sys.stdout

Re: how to run another file inside current file?

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 7:15 AM, Kevin Xi wrote: Hi, It's better to specify version of python you work with. Absolutely. I know nothing about python 3 but in python 2 you can do this with `exec`. Example: f = file('otherFile.py') exec f Py 2 has execfile that does the above. Py 3 do as above

Re: Future standard GUI library

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 10:03 AM, Beinan Li wrote: Not sure if this is the right place to talk about this. It is. Even less sure if I can move this discussion to tkinter list, The idea of replacing tkinter is not about improving tkinter ;-). Do you think tkinter is going to be the standard python

Re: TypeError: unbound method add() must be called with BinaryTree instance as first argument (got nothing instead)

2013-05-18 Thread Terry Jan Reedy
On 5/18/2013 3:46 PM, Peter Otten wrote: Dan Stromberg wrote: python 2.x, python 3.x and pypy all give this same error, though jython errors out at a different point in the same method. By the way, 3.x doesn't have unbound methods, so that should work. It does for this example (3.3.1) c =

Re: Harmonic distortion of a input signal

2013-05-19 Thread Terry Jan Reedy
On 5/19/2013 6:49 PM, Oscar Benjamin wrote: import numpy as np Create a square wave signal: x = np.zeros(50) x[:25] = -1 x[25:] = +1 x array([-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., 1.,

Re: Future standard GUI library

2013-05-20 Thread Terry Jan Reedy
On 5/20/2013 1:04 AM, Vito De Tullio wrote: Terry Jan Reedy wrote: 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

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

2013-05-20 Thread Terry Jan Reedy
On 5/20/2013 3:36 PM, Thomas Murphy wrote: talking about patches in the stdlib? Is there a separate library of patches? http://bugs.python.org http://docs.python.org/devguide/ -- http://mail.python.org/mailman/listinfo/python-list

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

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 URL:https://pypi.python.org/pypi/alea. Have you

Re: subclassing from unittest

2013-05-22 Thread Terry Jan Reedy
(verbosity=2, exit=False) # prints (3.3) -- Ran 0 tests in 0.000s OK Same as before the subclasses were added. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about evaluating raw_input() responses

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 12:47 AM, Steven D'Aprano wrote: 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* But all joking aside, eval is dangerous, yes, but it is not evil. He put that label on

Re: subclassing from unittest

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 2:58 AM, Ulrich Eckhardt wrote: Well, per PEP 8, classes use CamelCaps, so your naming might break automatic test discovery. Then, there might be another thing that could cause this, and that is that if you have an intermediate class derived from unittest.TestCase, that class on

Re: how to get the socket module compiled with SSL support

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 9:58 AM, Kihup Boo wrote: I am trying to make an HTTPS connection and read that HTTPS support is only available if the socket module was compiled with SSL support. _http://www.jython.org/docs/library/httplib.html_ Can someone elaborate on this? Where can I get the socket module

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 2:42 PM, Dave Angel wrote: On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: eggs(a,f) Traceback (most recent call last): File pyshell#29, line 1, in module eggs(a,f) File pyshell#1, line 1, in eggs def eggs(spam, ham): return spam % ham TypeError: not all arguments converted

Re: Non-identifiers in dictionary keys for **expression syntax

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 2:52 PM, Matthew Gilson wrote: This is a question regarding the documentation around dictionary unpacking. The documentation for the call syntax (http://docs.python.org/3/reference/expressions.html#grammar-token-call) says: If the syntax **expression appears in the function call,

Re: Simple algorithm question - how to reorder a sequence economically

2013-05-24 Thread Terry Jan Reedy
On 5/24/2013 4:14 AM, Peter Brooks wrote: What is the easiest way to reorder a sequence pseudo-randomly? That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg 2,1,4,3) that is different each time. I'm writing a simulation and would like to visit all the nodes in a different

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) sys.float_info.epsilon: print(zero is not allowed) The reason for the order is to do the easy calculation first and the harder one only if the first passes. --

Re: Output from to_bytes

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 8:02 AM, Mok-Kong Shen wrote: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) http://bugs.python.org/issue9951 http://bugs.python.org/issue3532 import binascii as ba for k in range(8,12,1): print(ba.hexlify(k.to_bytes(2,byteorder='big'))) b'0008'

Re: Encodign issue in Python 3.3.1 (once again)

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 12:36 PM, Νίκος Γκρ33κ wrote: This is the code that although correct becaus it works with englisg(standARD ASCII letters) it wont with Greek: if( log ): name = log # print specific client header info cur.execute('''SELECT hits, money FROM clients WHERE name

Re: Cutting a deck of cards

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 3:54 PM, Carlos Nepomuceno wrote: From: usenetm...@solar-empire.de [...] Not in Python3.x decks = 6 list(range(13 * 4 * decks)) == range(13 * 4 * decks) False Adiaŭ Marc What does list(range(13 * 4 * decks)) returns in Python 3?

Re: Short-circuit Logic

2013-05-26 Thread Terry Jan Reedy
On 5/26/2013 4:22 PM, Roy Smith wrote: In article mailman.2196.1369599562.3114.python-l...@python.org, Terry Jan Reedy tjre...@udel.edu wrote: On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: if not allow_zero and abs(x) sys.float_info.epsilon: print(zero

Re: Python error codes and messages location

2013-05-27 Thread Terry Jan Reedy
On 5/27/2013 12:54 PM, Carlos Nepomuceno wrote: I think PEP 3151 is a step ahead! That's almost exactly what I was looking for. Why did it take so long to have that implemented? Since this PEP involved changing existing features, rather than adding

Re: Python #ifdef

2013-05-28 Thread Terry Jan Reedy
On 5/28/2013 6:25 PM, Joel Goldstick wrote: On Tue, May 28, 2013 at 6:18 PM, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 28/05/2013 20:46, Carlos Nepomuceno wrote: I'd like to have something like '#ifdef' to mix code from Python 2 and 3

Re: The state of pySerial

2013-05-29 Thread Terry Jan Reedy
On 5/29/2013 4:00 PM, William Ray Wing wrote: On May 29, 2013, at 2:23 PM, Ma Xiaojun damage3...@gmail.com wrote: Hi, all. pySerial is probably the solution for serial port programming. Physical serial port is dead on PC but USB-to-Serial give it a second life. Serial port stuff won't

Re: The state of pySerial

2013-05-29 Thread Terry Jan Reedy
On 5/29/2013 3:47 PM, Grant Edwards wrote: On 2013-05-29, Ma Xiaojun damage3...@gmail.com wrote: pySerial is probably the solution for serial port programming. Physical serial port is dead on PC but USB-to-Serial give it a second life. Serial port stuff won't interest end users at all. But it

Re: Future standard GUI library

2013-06-01 Thread Terry Jan Reedy
On 6/1/2013 4:46 PM, Chris Angelico wrote: On Sun, Jun 2, 2013 at 4:18 AM, Wolfgang Keller felip...@gmx.net wrote: And by screenworkers I didn't refer to programmers. Those people rarely have to use the stuff that they implement. Of course not, programmers never use software they've

Re: Python 2-3 compatibility

2013-06-02 Thread Terry Jan Reedy
on that page, a reference to the six module, and more hits on the search page. Good luck. You are not the first to support the same range of versions (and for the same reasons). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Interactive interpreter hooks

2013-06-03 Thread Terry Jan Reedy
On 6/3/2013 3:55 AM, Steven D'Aprano wrote: The sys module defines two hooks that are used in the interactive interpreter: * sys.displayhook(value) gets called with the result of evaluating the line when you press ENTER; * sys.excepthook(type, value, traceback) gets called with the details of

Re: Bools and explicitness [was Re: PyWart: The problem with print]

2013-06-05 Thread Terry Jan Reedy
On 6/5/2013 2:11 AM, Russ P. wrote: But then, what would you expect of a language that allows you to write x = 1 x = Hello It's all loosey goosey -- which is fine for many applications but certainly not for critical ones. I believe Shedskin, a Python *subset* compiler*, will reject that,

Dijkstra (was Re: Source code to identify user through browser?)

2013-06-05 Thread Terry Jan Reedy
are not extreme' theorem. Corollary: if min(s) == 1 and sum(S) n, then max(S) 1 'Pigeonhole Principle' -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Mistakes in documentation

2013-06-06 Thread Terry Jan Reedy
On 6/6/2013 8:01 AM, Paul Volkov wrote: Where can I submit little mistakes in Python documantation? I found one while browsing tutorial.pdf (Python 3.3.2): Section 3.1 says (on page 12): word[2:5] # characters from position 2 (included) to 4 (excluded) ’tho’ Shouldn't the comment say 5

Re: Idiomatic Python for incrementing pairs

2013-06-08 Thread Terry Jan Reedy
but a bit slower than your in-lined version. I did not use __iadd__ and += because unpacking 'other' (here the process return) in the call does the error checking ('exactly two values') for 'free'. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 12:09 PM, Rui Maciel wrote: We've established that you don't like attribute declarations, at least those you describe as not fulfill a technical purpose. What I don't understand is why you claim that that would cause nothing but trouble. Three answers: Look how much trouble it

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 9:18 AM, Rui Maciel wrote: class Model: points = [] lines = [] Unless you actually need keep the points and lines ordered by entry order, or expect to keep sorting them by whatever, sets may be better than lists. Testing that a point or line is in the model

  1   2   >