Re: importing down in code rather than at top of file.

2016-08-29 Thread Terry Reedy
On 8/29/2016 1:57 PM, Tobiah wrote: Is it worth while to defer the import of a large module that seldom gets used in the script? import sys import os if hardly_ever_happens(): import large_module large_module.do_task() I imagine it takes a certain amount of

Re: Multimeter USB output

2016-08-28 Thread Terry Reedy
On 8/28/2016 5:13 AM, Joe wrote: Am 28.08.2016 um 00:45 schrieb Terry Reedy: On 8/27/2016 3:35 PM, Joe wrote: Hi, I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read the USB output of a DMM 'UT61B'. import usb.core import usb.util import usb.backend.libusb1 def Gosub

Re: Multimeter USB output

2016-08-27 Thread Terry Reedy
On 8/27/2016 3:35 PM, Joe wrote: Hi, I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read the USB output of a DMM 'UT61B'. import usb.core import usb.util import usb.backend.libusb1 def Gosub(): dev = usb.core.find(idVendor=0x1a86, idProduct=0xe008) # Digital

Re: Is duck-typing misnamed?

2016-08-27 Thread Terry Reedy
On 8/26/2016 7:58 PM, ROGER GRAYDON CHRISTMAN wrote: "If it walks like a duck, quacks like a duck,... " so there is indeed precedence for this so-called 'duck typing' but wouldn't it be more Pythonic to call this 'witch typing'? "How do you know she is a witch?" "She looks like one."

Re: Python 3 raising an error where Python 2 did not

2016-08-26 Thread Terry Reedy
On 8/26/2016 4:50 AM, d...@forestfield.co.uk wrote: In a program I'm converting to Python 3 I'm examining a list of divisor values, some of which can be None, to find the first with a value greater than 1. Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32 Type

Re: Asynchronous programming

2016-08-25 Thread Terry Reedy
On 8/11/2016 11:55 PM, Lawrence D’Oliveiro wrote: On Friday, August 12, 2016 at 2:25:05 AM UTC+12, Terry Reedy wrote: When I read something like "Python finally acquired an event loop in 3.4" I wonder where people have been. The tk event loop has been in Python perhaps for

Re: Does This Scare You?

2016-08-21 Thread Terry Reedy
On 8/21/2016 9:08 PM, eryk sun wrote: On Mon, Aug 22, 2016 at 12:44 AM, Chris Angelico wrote: "Trying to be" cross-platform? The point of these path modules is to *be* cross-platform. I can't call Windows APIs on my Linux box (short of messing around with VMs or Wine or

Re: saving octet-stream png file

2016-08-19 Thread Terry Reedy
On 8/19/2016 1:10 PM, Larry Martell wrote: I have some python code (part of a django app) that processes a request that contains a png file. The request is send with content_type = 'application/octet-stream' An 'octet' is a byte of 8 bits. So the content is a stream of bytes and MUST NOT be

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Terry Reedy
On 8/19/2016 4:56 AM, Lawrence D’Oliveiro wrote: It is handy to be able to keep complex expressions together sometimes, when breaking them up would simply obscure their structure. To avoid lines getting long, why not take advantage of the two available screen/page dimensions to make their

Re: I am new to python. I have a few questions coming from an armature!

2016-08-18 Thread Terry Reedy
On 8/18/2016 5:32 AM, Steven D'Aprano wrote: Beginners often do not understand that the body of a lambda expression is evaluated in a new local namespace, and only when the resulting function is called, the same as with a def statement. They then neglect to capture current values when writing

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 7:13 PM, Lawrence D’Oliveiro wrote: On Thursday, August 18, 2016 at 8:25:37 AM UTC+12, Terry Reedy wrote: for section_name, line_number in text.parser.toc: def goto(line=line_number): text.yview(line) drop.add_command(label

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:39 PM, Random832 wrote: On Wed, Aug 17, 2016, at 14:27, Terry Reedy wrote: That particular syntax was not really considered. At least 10 versions using 'if', 'then', 'else', and other tokens were. They all had the problem of requiring a new keyword such as 'then' or some other

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:43 PM, Marko Rauhamaa wrote: Terry Reedy <tjre...@udel.edu>: On 8/17/2016 2:39 AM, Steven D'Aprano wrote: "If I finish work on on time, go to the movies, otherwise just go home." is also real English syntax, and to me, more graceful. It is certainly mo

Re: JSON confusion

2016-08-17 Thread Terry Reedy
On 8/17/2016 12:35 PM, Steve Simmons wrote: I'm trying to write a small utility to find the closest railway station to a given (UK) postcode but the result is in JSON and I'm not familiar with it. I've got as far as extracting the JSON object and I can print the first level elements ("success"

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:07 AM, Steven D'Aprano wrote: I realise that there are occasions where we might deliberate choose to assign an intermediate value to its own variable, but all else being equal, which would you prefer? #A alist = [] alist.append(2) alist.append(4) alist.append(8) process(alist)

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
On 8/17/2016 2:39 AM, Steven D'Aprano wrote: On Wednesday 17 August 2016 06:59, Lawrence D’Oliveiro wrote: Here are some examples of that varying mileage. Quote: The Python syntax for conditional expressions

Re: Asynchronous programming

2016-08-11 Thread Terry Reedy
On 8/11/2016 2:34 AM, Christian Gollwitzer wrote: Am 11.08.16 um 06:38 schrieb Terry Reedy: You might be able to glean something from the succession of files I uploaded to https://bugs.python.org/issue27546 Integrate tkinter and asyncio (and async) I started with just mixing tk and asyncio

Re: Asynchronous programming

2016-08-10 Thread Terry Reedy
On 8/10/2016 11:53 PM, Steven D'Aprano wrote: The latest versions of Python are introducing new keywords for asynchronous programming, async and await. See PEP 492: https://www.python.org/dev/peps/pep-0492/ Is there a good beginner's tutorial introducing the basics of asynchronous programming?

Re: Question regarding stdlib distutils strtobool behavior

2016-08-09 Thread Terry Reedy
On 8/9/2016 9:22 AM, Joseph Bane wrote: Hello. It recently came to my attention that the strtobool function in the standard library doesn't return Python native boolean values, but rather returns integer 0 or 1: https://hg.python.org/cpython/file/3.5/Lib/distutils/util.py#l304 I am curious

Re: Running Python from the source repo

2016-08-09 Thread Terry Reedy
On 8/8/2016 5:25 PM, Random832 wrote: On Mon, Aug 8, 2016, at 15:25, Terry Reedy wrote: Last January, I wrote a batch file to build all three versions with the 'optional' extensions. I started rebuilding more often after this. 36\pcbuild\build.bat -e -d 35\pcbuild\build.bat -e -d 27\pcbuild

Re: Running Python from the source repo

2016-08-09 Thread Terry Reedy
On 8/8/2016 5:16 PM, Zachary Ware wrote: On Mon, Aug 8, 2016 at 2:25 PM, Terry Reedy <tjre...@udel.edu> wrote: Last January, I wrote a batch file to build all three versions with the 'optional' extensions. I started rebuilding more often after this. 36\pcbuild\build.bat -e -d 35\p

Re: Running Python from the source repo

2016-08-08 Thread Terry Reedy
On 8/8/2016 12:24 PM, Zachary Ware wrote: I generally assume that if I'm testing a patch, I'm going to need to rebuild regardless of what the patch actually touches. I often wait until the patch is applied before I do the rebuild, or if I'm manually testing a bug I go ahead and do the rebuild

Re: How do I make a game in Python ?

2016-08-06 Thread Terry Reedy
On 8/6/2016 5:51 PM, Cai Gengyang wrote: As in, any recommended websites that helps users create complex games in Python ? For 2D graphics, try pygame among others. For 3D, I don't know what is current. On Sunday, August 7, 2016 at 5:41:25 AM UTC+8, Ian wrote: On Aug 6, 2016 11:57 AM,

Re: Python slang

2016-08-06 Thread Terry Reedy
On 8/6/2016 2:30 AM, Michael Selik wrote: When people ask me why the core classes are lowercased, Int, float, list, dict, etc were once functions that return objects of type 'int', 'float', 'list', 'dict', etc, before they became 'new-style classes', which are not just 'classes'. The

Re: Python slang

2016-08-05 Thread Terry Reedy
On 8/5/2016 6:00 PM, Marco Sulla via Python-list wrote: I have a simple curiosity: why Python has much keywords, and some builtin types and methods, that are different from the other languages? What is the rationale? I'm referring to: * `except` instead of `catch` Python partly takes its cue

Re: Python Error message

2016-08-04 Thread Terry Reedy
On 8/4/2016 12:19 PM, MRAB wrote: In those rare occasions when you do write a bare except, A bare "except:" is never needed and in my opinion, and that of others, one should never write one (except possibly for experimentation). Be explicit and write "except BaseException:" or "except

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-04 Thread Terry Reedy
Making repeat a keyword would have such an extremely high cost that it is out of the question and not a sane proposal. To start with, it is used in two major, widely used APIs. itertools.repeat + 50 uses in other itertools and tests + all the imports and and uses of repeat() in code all over

Re: Debugging (was Re: Why not allow empty code blocks?)

2016-08-02 Thread Terry Reedy
On 8/2/2016 7:05 AM, BartC wrote: On 31/07/2016 19:58, Terry Reedy wrote: On 7/31/2016 6:18 AM, BartC wrote: repeat N: The benefit is not so much performance, but being able to express something very easily and quickly. The cost of the 'repeat' contraction is that one cannot use

Re: gmane sending

2016-08-02 Thread Terry Reedy
On 8/2/2016 10:42 AM, Robin Becker wrote: I just got a mail bounce from my normal gmane --> nntp setup sending to python-python-l...@m.gmane.org. Have others seen this and does it mean the end of gmane has happened? See I am reading and sending via gmane right now.

Re: Tcl/Tk for Python 3.6.0a3 on Os X 10.9.5

2016-08-02 Thread Terry Reedy
On 8/2/2016 4:21 AM, munozvvale...@gmail.com wrote: I am new to the programming world but I need to learn this program for a research class that I am taking. I have downloaded Python 3.6.0a3 on a Mac 10.9.5 and realized that I also need to download an Active Tcl for it. I can't find one for

Debugging (was Re: Why not allow empty code blocks?)

2016-07-31 Thread Terry Reedy
On 7/31/2016 6:18 AM, BartC wrote: The costs are near zero: at minimum, a syntactic construct such as: repeat N: that expands to: for _ in range(N): The benefit is not so much performance, but being able to express something very easily and quickly. The cost of the 'repeat' contraction

Re: Why not allow empty code blocks?

2016-07-29 Thread Terry Reedy
On 7/29/2016 4:58 AM, Antoon Pardon wrote: Op 23-07-16 om 16:19 schreef Chris Angelico: On Sun, Jul 24, 2016 at 12:00 AM, BartC wrote: Or, for debugging or other reasons, when you need to comment out the contents of a block. Then pass needs to be added. How often do you

Re: TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-29 Thread Terry Reedy
On 7/29/2016 7:59 AM, eryk sun wrote: On Fri, Jul 29, 2016 at 8:43 AM, Antoon Pardon wrote: The problem seems to come from my expectation that a file is its own iterator and in python3 that is no longer true for a NamedTemporaryFile. For some reason it uses a

Re: TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-29 Thread Terry Reedy
On 7/29/2016 4:43 AM, Antoon Pardon wrote: Below is a short program that illustrate the problem It works with python2, whether you use the -c option or not. It only works with python3 if you use the -c option. The problem seems to come from my expectation that a file is its own iterator and in

Re: working with OpenOffice Calc

2016-07-27 Thread Terry Reedy
On 7/27/2016 1:54 PM, id23...@gmail.com wrote: I am looking for a library that will allow me to work with Calc documents from Python. But so far I was not able to build properly working environment for that. You posted this same question 1 1/2 hours before under a different name. Please

Re: python and open office

2016-07-27 Thread Terry Reedy
On 7/27/2016 12:37 PM, Chris Kaynor wrote: def __init__(self, name: str): That "name: str" syntax is called function annotations, and was added in Python 3, and you are trying to use the module in Python 2.7. There may be another variation of the module compatible with Python 2, or you'll need

Re: FW: error in python IDLE

2016-07-26 Thread Terry Reedy
On 7/26/2016 1:51 PM, Nakirekanti Jahnavi wrote: Sent from Mail for Windows 10 From: Nakirekanti Jahnavi The above is all I see. This is a text-only, no-attachment list. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Unittest

2016-07-26 Thread Terry Reedy
On 7/25/2016 12:45 PM, Joaquin Alzola wrote: Hi Guys I have a question related to unittest. I suppose a SW that is going to live will not have any trace of unittest module along their code. In order to test idlelib, I had to a _utest=False (unittest = False) parameter to some functions.

Re: Caller's module name, function/method name and line number for output to logging

2016-07-25 Thread Terry Reedy
On 7/25/2016 3:16 PM, Malcolm Greene wrote: Is there a technique for accessing a function's *CALLER* module name, function/method name and line number so that this information can be Look in the inspect module for the inspect stack function. Note that when you call the function, it needs to

Re: How asyncio works? and event loop vs exceptions

2016-07-23 Thread Terry Reedy
On 7/22/2016 8:27 PM, Marco S. via Python-list wrote: I'm developing a web app based on aiohttp, and I find the event loop concept very interesting. I never programmed with it before, but I know that node.js and GUIs are based on it. What I can't understand is how asyncio make it possible to

Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Terry Reedy
On 7/21/2016 12:07 PM, Malcolm Greene wrote: I assume that one downside to the exec() approach is that there is no persistent namespace for this code's functions and classes, eg. after the exec() completes, its namespace disappears and is not available to code that follows? Objects only

Re: an error

2016-07-19 Thread Terry Reedy
On 7/19/2016 2:07 AM, WePlayGames WeEnjoyIt wrote: pygame1.blit(image3,(143,146) If you type this line (including \n) into IDLE's Python-aware editor, it will notice that there is an open parenthesis for a function call and indent the next line to the space under the 'i' of image. This

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Terry Reedy
On 7/16/2016 6:14 PM, shrey.de...@gmail.com wrote: I have found it slightly frustrating that Python does not have built-in support for advanced data structures (Linked Lists, You and I have different ideas of 'advanced data structures' ;-). To me, linked list are limited structures used in

Re: Were is a great place to Share your finished projects?

2016-07-14 Thread Terry Reedy
On 7/14/2016 3:04 PM, hasan.di...@gmail.com wrote: Python's primary repository is Mercurial (hg.python.org), not Git. CPython's current repository Ditto for the PSF Python docs. Were python to switch, Like it or not, CPython and the Docs are moving to git and github. PEPs and the

Re: What is precision of a number representation?

2016-07-11 Thread Terry Reedy
On 7/11/2016 6:17 PM, Ethan Furman wrote: On 07/11/2016 02:51 PM, Chris Angelico wrote: This is why it's important to be able to record precisions of arbitrary numbers. If I then measure the width of this corridor with a laser, I could get an extremely precise answer - say, 2,147 millimeters,

Re: What is precision of a number representation?

2016-07-11 Thread Terry Reedy
On 7/11/2016 5:51 PM, Chris Angelico wrote: This is why it's important to be able to record precisions of arbitrary numbers. If I then measure the width of this corridor with a laser, I could get an extremely precise answer - say, 2,147 millimeters, with a precision of four significant digits,

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Terry Reedy
On 7/11/2016 3:27 PM, Ian Kelly wrote: On Mon, Jul 11, 2016 at 12:54 PM, Terry Reedy <tjre...@udel.edu> wrote: In any case, I think it an improvement to say that '0x00123' has a field width of 7 rather than a 'precision' of 5. '{:#07x}'.format(0x123) # specifiy field width '0

Re: Compression of random binary data

2016-07-11 Thread Terry Reedy
On 7/11/2016 2:09 PM, Joonas Liik wrote: On 11 July 2016 at 20:52, wrote: What kind of statistic law or mathematical conjecture or is it even a physical law is violated by compression of random binary data? Off-topic, but... It is unclear whether you mean

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Terry Reedy
On 7/11/2016 1:24 PM, Ethan Furman wrote: On 07/11/2016 09:28 AM, Steven D'Aprano wrote: On Tue, 12 Jul 2016 01:04 am, Ian Kelly wrote: Er, what? I count *five* digits in "00123", not three. You seem to be assuming that "precision" can only refer to digits after the decimal place, but

Re: input vs. readline

2016-07-08 Thread Terry Reedy
On 7/8/2016 7:17 PM, John Nagle wrote: If "readline" is imported, "input" gets "readline" capabilities. It also loses the ability to import control characters. It doesn't matter where "readline" is imported; an import in some library module can trigger this. You can try this with a simple

Re: Help with subclasses and classes

2016-07-03 Thread Terry Reedy
On 7/2/2016 8:58 PM, cadenmr...@gmail.com wrote: When i run the code I get this error : Traceback (most recent call last): File "C:/Python25/chapter2", line 18, in bank=InterestAccount(5,1000,0.5) NameError: name 'InterestAccount' is not defined I can't find the issue, any help? class

Re: subprocess startup error

2016-07-02 Thread Terry Reedy
On 7/1/2016 11:43 PM, Veek. M wrote: Shweta Dinnimani wrote: hi hello, I'm begineer to python programming.. I had installed python 3.5.1 version on my windows 7 system. I was fine earlier and now when i was trying the programs on string i'm facing the subprocess startup error. IDLE is not

Re: Controlling the Mac OSX GUI via Python?

2016-06-30 Thread Terry Reedy
On 6/30/2016 3:22 PM, maitlandmontmore...@gmail.com wrote: I'd like to use Python to do some simple OSX GUI manipulations such as automatically arranging windows, periodically refreshing applications across multiple desktops, etc.. Is this possible and if so, is there a preferred package?

Re: "for/while ... break(by any means) ... else" make sense?

2016-06-29 Thread Terry Reedy
On 6/29/2016 6:01 AM, Victor Savu wrote: There are many posts trying to explain the else after for or while. My take: a while statement *is* a repeated if statement, and that is how it is implemented. while condition: true() is equivalent to and implemented in machine language without

Re: __all__ attribute: bug and proposal

2016-06-27 Thread Terry Reedy
On 6/27/2016 6:29 PM, Pavel S wrote: Frankly, do you always unit-test if __all__ works? One should. CPython's test suite includes test___all__. I believe it imports every stdlib module, looks for __all__, and if present, tests that it works. It probably executes 'from module import *'.

Re: Proposal: named return values through dict initialization and unpacking

2016-06-21 Thread Terry Reedy
On 6/21/2016 3:34 AM, Ari Freund via Python-list wrote: I'd like to run this idea by the community to see if it's PEP worthy and hasn't been already rejected. Background Just as keyword arguments enhance code readability and diminish the risk of bugs, so too would named return values.

Re: best text editor for programming Python on a Mac

2016-06-18 Thread Terry Reedy
On 6/18/2016 3:04 AM, Michael Vilain via Python-list wrote: In article , supp...@ecourierz.com wrote: use notepad++ To me, for programming only in Python, IDLE beats Notepad++. Some features noted below. [pay no attention to the

Re: Possible PEP - two dimensional arrays?

2016-06-08 Thread Terry Reedy
On 6/7/2016 8:17 PM, Harrison Chudleigh wrote: I was programming a computer game and found that while 1D arrays can be created using the module array, there is no module for two-dimensional arrays, unlike languages like C. Currently, the closest thing Python has to a 2D array is a dictionary

Re: Spreading a class over multiple files

2016-06-05 Thread Terry Reedy
On 6/5/2016 2:55 AM, Mark Summerfield wrote: Sometimes I want to spread a class over multiple files. My experience with trying to work with two do-all classes in idlelib has engendered a dislike for such. It is hard to find things in a kitchen-sink class. To switch IDLE from being a

Re: Don't put your software in the public domain

2016-06-04 Thread Terry Reedy
On 6/4/2016 4:24 AM, Marko Rauhamaa wrote: Paul Rudin : Don't confuse consideration with agreement - they're seperate legal concepts. Agreement is certainly necessary in pretty much all jurisdictions. Consideration is required in most common law jurisdiction (England,

Re: I'm wrong or Will we fix the ducks limp?

2016-06-03 Thread Terry Reedy
On 6/3/2016 10:20 AM, Sayth Renshaw wrote: Very briefly because I hope to shot down eloquently. Python is beautiful and is supposed to be a duck typed language, Yes? Then if I create and assign to a new variable with a list action why does the duck not quack? It feels wrong to spend a line

Re: Recommendation for Object-Oriented systems to study

2016-06-01 Thread Terry Reedy
On 5/31/2016 1:52 PM, Ankush Thakur wrote: Hi Terry, Can you point me towards the source code? For IDLE 3.4.4 or 3.5.1: /Lib/idlelib/help.py, at least on Windows. > by "after reading it carefully", do you mean you or me? :D You. I wrote it and already read it carefully. Beyond "pick a

Re: Manipulate GIL to have Python thread work with pthread native ones

2016-05-31 Thread Terry Reedy
On 5/31/2016 1:16 AM, qshh...@alumni.sjtu.edu.cn wrote: Hi Python experts, I need to extend Python with C/C++ to interact with an in-house legacy API. I'm implementing a data subscriber with Python, which subscribes to a data publisher (actually a ZeroMQ publisher socket) and will get notified

Re: Recommendation for Object-Oriented systems to study

2016-05-30 Thread Terry Reedy
On 5/30/2016 11:57 AM, Ankush Thakur wrote: On Monday, May 30, 2016 at 12:00:01 AM UTC+5:30, Terry Reedy wrote: Read the source code of the doctest module in the standard library. Or pick a module with classes that interests you, with the caveat that some are old and crusty. I learned from

Re: [spam] Re: look what I've found [ignore]

2016-05-29 Thread Terry Reedy
On 5/29/2016 4:10 PM, Gene Heskett wrote: On Sun, May 29, 2016, at 14:14, Terry Reedy wrote: Spam missed by the normally excellent spam filter. Ignore it. Blasted directly to this, and several other python related lists. The source address is NOT in the email headers, and I'm sure

Re: Coding systems are political (was Exended ASCII and code pages)

2016-05-29 Thread Terry Reedy
On 5/29/2016 2:12 AM, Rustom Mody wrote: In short that a € costs more than a $ is a combination of the factors - a natural cause -- there are a million chars to encode (lets assume that the million of Unicode is somehow God-given AS A SET) - an artificial political one -- out of the

Re: Recommendation for Object-Oriented systems to study

2016-05-29 Thread Terry Reedy
On 5/29/2016 1:49 PM, Michele Simionato wrote: On Sunday, May 29, 2016 at 4:42:17 PM UTC+2, Ankush Thakur wrote: Hello, I'm a self-taught programmer who has managed to claw his way out of Python basics and even covered the intermediate parts. But I feel I have a ton of theory in my head and

[spam] Re: look what I've found [ignore]

2016-05-29 Thread Terry Reedy
Spam missed by the normally excellent spam filter. Ignore it. On 5/29/2016 6:39 AM, Python-list wrote: Look what I've just found on the web, that really cool, yeah, more info here [likely toxic url snipped] My Best, Python-list -- Terry Jan Reedy --

Re: Question about imports and packages

2016-05-24 Thread Terry Reedy
On 5/24/2016 9:02 PM, Steven D'Aprano wrote: On Wed, 25 May 2016 09:35 am, Gerald Britton wrote: For brevity, here's your package setup: testpkg/ +-- __init__.py +-- testimport.py which runs "from testpkg.testimported import A" +-- testimported.py containing class A Your package layout is

Re: Image loading problem

2016-05-21 Thread Terry Reedy
On 5/21/2016 12:54 PM, Peter Otten wrote: sweating_...@yahoo.com wrote: I am working on an image project, and I can display my image in main(). I mean, I can load my image in my main(). Needless, it is awkward. I am trying to load my image with a function, but got an empty image window popped

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Terry Reedy
On 5/19/2016 4:10 PM, Mike Driscoll wrote: On Thursday, May 19, 2016 at 11:23:53 AM UTC-5, Terry Reedy wrote: In my case, I learned better how to test IDLE from a user perspective. For tkinter apps, an external program such as Selenium is not needed. Tk/tkinter have the simulated event

Re: Python 3.5.1

2016-05-19 Thread Terry Reedy
On 5/19/2016 12:47 PM, Bella via Python-list wrote: Thisis my first encountering with Python. I have successfully downloaded Python3.5.1 for Windows but see only a black window with command prompt. If you start Python from the Python directory on the Start menu, you should see a black window

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Terry Reedy
On 5/19/2016 11:33 AM, Mike Driscoll wrote: On Wednesday, May 18, 2016 at 4:48:28 PM UTC-5, Andrew Farrell wrote: Hi Jacob, You are probably looking for the book Test-Driven Development with Python . Electronic version is free

Re: Distinction between “class” and “type”

2016-05-13 Thread Terry Reedy
On 5/13/2016 1:07 AM, Ben Finney wrote: Howdy all, Ever since Python's much-celebrated Grand Unification of classes and types, I have used those terms interchangeably: every class is a type, and every type is a class. That may be an unwise conflation. With the recent rise of optional type

Re: Intel Distribution for Python

2016-05-10 Thread Terry Reedy
On 5/10/2016 11:12 PM, Chris Angelico wrote: On Wed, May 11, 2016 at 12:00 PM, beliavsky--- via Python-list wrote: The Intel Distribution for Python 2017 Beta https://software.intel.com/en-us/python-distribution is available for Windows, Linux, and Mac OS for Python

Re: Pylint prefers list comprehension over filter...

2016-05-10 Thread Terry Reedy
On 5/10/2016 11:35 AM, pcmantic...@gmail.com wrote: The bad-builtin check is now an extension, so using the first case would enable it. The 'old' (not 'bad') builtin check should include using map instead of a comprehension. The check should also pay attention to whether the function

Re: Pylint prefers list comprehension over filter...

2016-05-10 Thread Terry Reedy
On 5/10/2016 9:51 AM, Claudiu Popa wrote: Thank you for letting us know. While pylint is indeed opinionated in some cases, we're not trying to be "arrogant", as you put it, towards Guido or the other core developers. What's sad in this particular case is that the feedback had to come in rather

Re: json.loads(...) ValueError: Expecting value: line 1 column 1 (char 0)

2016-05-09 Thread Terry Reedy
On 5/9/2016 3:56 PM, zljubi...@gmail.com wrote: Hi, in python3 my variable looks like this: a = b'{"uuid":"5730e8666ffa02.34177329","error":""}' str(a) = 'b\'{"uuid":"5730e8666ffa02.34177329","error":""}\'' If I execute the following command I get the error: json.loads(str(a)) Traceback

Re: Help for a complex RE

2016-05-08 Thread Terry Reedy
On 5/8/2016 12:32 PM, Sergio Spina wrote: Il giorno domenica 8 maggio 2016 18:16:56 UTC+2, Peter Otten ha scritto: Sergio Spina wrote: In the following ipython session: Python 3.5.1+ (default, Feb 24 2016, 11:28:57) Type "copyright", "credits" or "license" for more information. IPython

Re: pylint woes

2016-05-07 Thread Terry Reedy
On 5/7/2016 3:52 PM, Ray Cote wrote: Biggest issue I have with pyLint is that it complains when function parameters are indented twice vs. once. pyFlakes likes the twice. Example: def function_name( parm_1, long_parm_name, …. end_of_long_list_of params)

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Terry Reedy
On 5/7/2016 3:17 PM, Christopher Reimer wrote: For my purposes, I'm using the list comprehension over filter to keep pylint happy. How sad. The pylint developers arrogantly take it on themselves to revise Python, against the wishes of Guido and the other core developers, and you and feel

Re: pylint woes

2016-05-07 Thread Terry Reedy
On 5/7/2016 12:51 PM, DFS wrote: This more-anal-than-me program generated almost 2 warnings for every line of code in my program. w t hey? If you don't like it, why do you use it? I suppose the answer is that it did find a few things to check. You might be happier with pychecker, which is

Python is an Equal Opportunity Programming Language

2016-05-05 Thread Terry Reedy
https://motherboard.vice.com/blog/python-is-an-equal-opportunity-programming-language from an 'Intel® Software Evangelist' -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Interacting with Subprocesses

2016-05-04 Thread Terry Reedy
On 5/4/2016 2:41 PM, Dick Holmes wrote: I am attempting to write a Python program that will interact with a (non-Python) process. The programs will run under MinGW. The process can use stdin/stdout commands and responses and can work with pipes. The problem I'm having is that I can't find any

Re: How to become more motivated to learn Python

2016-05-04 Thread Terry Reedy
On 5/3/2016 10:55 PM, Cai Gengyang wrote: Guess it would be really cool to work on AI and games. ( I have been addicted to computer games for a long time lol --- To be able to design a blockbuster like Starcraft 2, Diablo 3 or Final Fantasy 7 would be an incredible feat !) In case you like

Re: Trouble porting glob bash behavior with argparse to windows shell

2016-05-03 Thread Terry Reedy
On 5/3/2016 4:55 PM, Sayth Renshaw wrote: Is there something obvious to this I am doing wrong? Sayth Somethin happened so that I don't see what you did. Fortunately, it did show up for Peter, between the '?' and name, so he could answer. -- Terry Jan Reedy --

Re: Saving Consol outputs in a python script

2016-05-03 Thread Terry Reedy
On 5/3/2016 8:14 AM, drewes@gmail.com wrote: Hello, I'm new to python and have a Question. I'm running a c++ file with a python script like: import os import subprocess subprocess.call(["~/caffe/build/examples/cpp_classification/classification", "deploy.prototxt", "this.caffemodel",

Re: Not x.islower() has different output than x.isupper() in list output...

2016-05-03 Thread Terry Reedy
On 5/3/2016 11:42 AM, Grant Edwards wrote: Interesting. FWIW, Å and Å definitely look different with the terminal and font I'm using (urxvt with -misc-fixed-medium-r-normal-*-18-120-*-*-*-90-iso10646-*) In the fixed pitch font used by Thunderbird (Courier?), Angstrom Å has the circle

Re: You gotta love a 2-line python solution

2016-05-02 Thread Terry Reedy
On 5/2/2016 12:31 AM, Stephen Hansen wrote: On Sun, May 1, 2016, at 08:39 PM, DFS wrote: To save a webpage to a file: - 1. import urllib 2. urllib.urlretrieve("http://econpy.pythonanywhere.com /ex/001.html","D:\file.html")

Re: What should Python apps do when asked to show help?

2016-05-02 Thread Terry Reedy
On 5/1/2016 9:48 PM, Steven D'Aprano wrote: On Mon, 2 May 2016 03:04 am, Grant Edwards wrote: On 2016-05-01, Steven D'Aprano wrote: On Mon, 2 May 2016 02:30 am, Grant Edwards wrote: In discussions like these, it would be important to draw from precedents. Are there

Re: about special characters

2016-04-30 Thread Terry Reedy
On 4/30/2016 2:13 PM, Jianling Fan wrote: I am using python 2.7 in Windows 7 Enterprise version. Here is the the filename that cause the problem: "Decock-2013-On the potential of δ18O and δ15N.pdf" When I delete the "δ" in the filename, the script works good. You may be able to get "δ" (and

Re: about special characters

2016-04-29 Thread Terry Reedy
On 4/29/2016 9:48 PM, Ben Finney wrote: Steven D'Aprano writes: On Sat, 30 Apr 2016 09:52 am, Ben Finney wrote: (There has never been a Python 27. I assume Python 2.7 is what you meant.) I believe that Python X.Y shows up as "PythonXY" under Windows. As a directory

Re: asyncio and subprocesses

2016-04-24 Thread Terry Reedy
On 4/24/2016 6:07 PM, David wrote: Is this a bug in the asyncio libraries? Is this a fixed bug, already? I am using Python 3.4.2 as distributed in Ubuntu Lucid, with built-in asyncio. The people who patch asyncio do not read this list. Either install a current release or try the tulip

Re: Guido sees the light: PEP 8 updated

2016-04-20 Thread Terry Reedy
On 4/19/2016 11:41 PM, Chris Angelico wrote: On Wed, Apr 20, 2016 at 1:23 PM, Terry Reedy <tjre...@udel.edu> wrote: It kinda looks like Hypertalk syntax, which some of you may remember I'm exceedingly fond of. There's no reason why a GUI editor couldn't display Python code using such &qu

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Terry Reedy
On 4/19/2016 9:38 PM, Steven D'Aprano wrote: So-called "visual programming environments" (think: Visual Basic) are well-suited to laying out the interface of GUI applications. They might even be useful for extremely limited mini-languages like regexes. I'm told that there are still people who

Re: HTTPServer and SSL

2016-04-17 Thread Terry Reedy
On 4/18/2016 1:39 AM, Terry Reedy wrote: My apologies for the tired, twitchy finger junk post that I noticed 1/2 second after clicking the wrong button and I wish I oould delete. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: HTTPServer and SSL

2016-04-17 Thread Terry Reedy
On 4/17/2016 10:56 AM, Radek Holý wrote: Hello, some people recommend following implementation of a simple HTTP server that supports SSL: asdfghjkki Handler = http.server.BaseHTTPRequestHandlerhttpd = http.server.HTTPServer(("", 4443), Handler) httpd.socket = ssl.wrap_socket(httpd.socket,

Re: error with tkinter, help

2016-04-16 Thread Terry Reedy
On 4/16/2016 9:31 PM, blueridicul...@gmail.com wrote: So I was reading https://wiki.python.org/moin/TkInter for help. > I got to step 3 under "Checking your Tkinter support." > Nothing happens when I do steps 1 or 2, and when I do step 3, > I get this error: Traceback (most recent call last):

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread Terry Reedy
On 4/16/2016 12:58 PM, Larry Martell wrote: On Sat, Apr 16, 2016 at 12:51 PM, Marko Rauhamaa wrote: Larry Martell : I have worked for many companies where you are required to get a clean run of pep8 on your code before your pull request will even be

Re: Dynamic inputs

2016-04-16 Thread Terry Reedy
On 4/16/2016 3:35 AM, durgadevi1 wrote: what does dynamic inputs mean and how is it implemented in python programming? 'dynamic input' is new to me. I would take it to mean input that is not available until the program is running. Inputs from people and sensors would qualify. But maybe

<    5   6   7   8   9   10   11   12   13   14   >