Re: Idiomatic code validator?

2016-09-20 Thread Terry Reedy
On 9/20/2016 11:41 AM, Tim Johnson wrote: Not to confuse idiomatic code validation with pep8 validation Strictly speaking, there cannot be a mechanical PEP 8 validator, as any mechanical checker violates the admonitions of the beginning sections 'Introductions' and 'A Foolish Consistency is t

Re: Nested for loops and print statements

2016-09-25 Thread Terry Reedy
On 9/26/2016 1:59 AM, Cai Gengyang wrote: Why is it that you need a print() at the end to create the table for example 1: Example 1 --- for row in range(10): for column in range(10): print("*",end=" ") # Print a blank line for next row print() These indents are either 4

Re: Nested for loops and print statements

2016-09-26 Thread Terry Reedy
On 9/26/2016 12:54 PM, Cai Gengyang wrote: Which piece of code is indented with tabs and which one is indented with spaces ? I told you in my initial answer, where I said, referring to the two indented lines in one 'piece of code', "These indents are 4 spaces and 1 tabs." It is the mixture

Re: event loop vs threads

2016-09-27 Thread Terry Reedy
On 9/27/2016 12:01 AM, srinivas devaki wrote: how does Python switch execution and maintain context i.e function stack etc,.. for co-routines and why is it less costly than switching threads which almost do the same, and both are handled by Python Interpreter itself(event loop for co-routines and

Re: Is there a way to change the closure of a python function?

2016-09-27 Thread Terry Reedy
On 9/27/2016 11:01 AM, Chris Angelico wrote: On Wed, Sep 28, 2016 at 12:01 AM, Peng Yu wrote: Hi, In many other functional language, one can change the closure of a function. Is it possible in python? http://ynniv.com/blog/2007/08/closures-in-python.html From the blog post: """In some lang

Re: Syncing up iterators with gaps

2016-09-28 Thread Terry Reedy
On 9/28/2016 3:10 PM, Tim Chase wrote: I've got several iterators sharing a common key in the same order and would like to iterate over them in parallel, operating on all items with the same key. I've simplified the data a bit here, but it would be something like data1 = [ # key, data1 (1

Re: Expression can be simplified on list

2016-09-29 Thread Terry Reedy
On 9/29/2016 12:36 PM, MRAB wrote: On 2016-09-29 16:56, Steve D'Aprano wrote: On Thu, 29 Sep 2016 09:53 pm, MRAB wrote: What if an _exhausted_ iterator was falsey? Logic is about binary distinctions, rather than about 'truth'. For non-buggy iterator it, the useful binary distinction is whe

Re: Expression can be simplified on list

2016-09-29 Thread Terry Reedy
On 9/29/2016 2:47 AM, Rustom Mody wrote: On Thursday, September 15, 2016 at 1:43:05 AM UTC+5:30, Terry Reedy wrote: On 9/14/2016 3:16 AM, Rustom Mody wrote: In THOSE TYPES that element can justifiably serve as a falsey (empty) type However to extrapolate from here and believe that ALL TYPES

Re: Save Idle Options

2016-09-30 Thread Terry Reedy
On 9/29/2016 9:33 PM, tce...@comcast.net wrote: Win 10 pro 32, Python 3.6 I’m new to Python and installed Python with Idle, which I like as an IDE. But I’m mystified as to how to make interface options stick. Opened Options, Configure Idle. Changed font to Consolas Bold. And stopped dead. There

Re: What is a mechanism equivalent to "trace variable w ..." in Tcl for Python?

2016-09-30 Thread Terry Reedy
On 9/30/2016 2:23 PM, Les Cargill wrote: A really interesting design approach in Tcl is to install a callback when a variable is written to. This affords highly event-driven programming. Example ( sorry; it's Tcl ) : namespace eval events { set preRPM -1 proc handleRPM { args } {

Re: ConfigParser: use newline in INI file

2016-10-01 Thread Terry Reedy
On 10/1/2016 10:56 AM, Thorsten Kampe wrote: ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to signal to ConfigParser that there is a line break? Without an example or two, I don't really understand the question enough to answer. -- Terry Jan Reedy -- https://mail.python.

Re: unintuitive for-loop behavior

2016-10-01 Thread Terry Reedy
On 10/1/2016 8:24 AM, Rustom Mody wrote: Yeah by comprehension-variable I mean the one that sits left of the ‘in’ inside the conprehension. In other words, a 'loop variable within a comprehension'. Keep in mind that there may be multiple targets for the implicit (hidden) assignment, so ther

Re: Merecurial and Python-2.7.x, Python-3.Y

2016-10-01 Thread Terry Reedy
On 10/1/2016 5:31 AM, Michael Felt wrote: Finally, I got to where I understood what needed to be done to get both Mercurial built - and the the new SSL requirements met. So, running: # hg clone https://hg.python.org/cpython works. What is the next step to getting Python-2.7 AND Python-3.7 so I

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Terry Reedy
On 10/8/2016 2:56 AM, Steve D'Aprano wrote: Just copy and paste it into your Python IDLE and let me know what you get I don't normally use IDLE, and you shouldn't assume that everyone does. *That* is the extra information we need to solve the problem: The IDLE interactive interpreter in Pyth

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Terry Reedy
On 10/8/2016 11:51 PM, Cai Gengyang wrote: pygame = True while not done: for event in pygame.event.get(): Traceback (most recent call last): File "", line 2, in for event in pygame.event.get(): AttributeError: 'bool' object has no attribute 'event' pygame == True and True ha

Re: How to process syntax errors

2016-10-10 Thread Terry Reedy
On 10/10/2016 11:24 AM, Chris Angelico wrote: On Tue, Oct 11, 2016 at 1:13 AM, wrote: Is there any way to capture syntax errors and process them ? I want to write a function which calls every time whenever there is syntax error in the program. However, you can catch this at some form of ou

Re: shadows name from outer scope

2016-10-11 Thread Terry Reedy
On 10/11/2016 11:50 AM, Daiyue Weng wrote: Hi, I have the following code structure, def one_func(param1, param2, param3): process_outcome = {'dict': None} outcome = another_func(param1, process_outcome, db_host=param2, funcs_to_run=param3) PyCharm warns me Shadows name from outer sc

Re: How to process syntax errors

2016-10-11 Thread Terry Reedy
On 10/11/2016 4:02 AM, Pierre-Alain Dorange wrote: Using this function, the code is "compiled". I do not think this function is often used and most python project simply use the interpreter (which do a small translation into byte-code to be faster and check syntax error before running interpreta

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 8:59 PM, Skip Montanaro wrote: I'm trying to port some code from Python 2 to 3, and beyond the usual mechanical stuff, I've encountered a difference between the str() of floats. Here's an example. In Python 3 I get: print(repr(27.04 - 0.01)) 27.028 print(str(27.04 -

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 9:30 PM, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed was

Re: How to process syntax errors

2016-10-12 Thread Terry Reedy
On 10/12/2016 5:59 AM, mr.puneet.go...@gmail.com wrote: # I created a platform class with different method in a file > # and making it as a package. class platform: def connect(self): # connect device def destroy(self): # destroy device def config(self, command):

Re: Scripting Help please

2016-10-12 Thread Terry Reedy
On 10/12/2016 4:37 PM, LongHairLuke wrote: Hi l am on my way to make a bot for the game Piano Tiles 2. But the code l have written so far saids invalid syntax at 2nd line. Here is my code: If you want to write Python code, start by working through the tutorial included with the docs. -- Terr

Re: [FAQ] "Best" GUI toolkit for python

2016-10-20 Thread Terry Reedy
On 10/20/2016 2:02 AM, Paul Rubin wrote: pozz writes: What can I do and what *can't* I do with Tkinter? I look at the very carefully tuned and sometimes animated UI's in fancy desktop applications like Gimp and don't see a way to do similar things in Tkinter. Since I have not seen Gimp, I

Re: Odd name shadowing in comprehension

2016-10-22 Thread Terry Reedy
On 10/22/2016 7:57 PM, Chris Angelico wrote: This surprised me. Python 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. y=6 [(x,y) for x in range(y) for y in range(3)] [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1,

Re: Odd name shadowing in comprehension

2016-10-22 Thread Terry Reedy
On 10/22/2016 11:24 PM, Chris Angelico wrote: On Sun, Oct 23, 2016 at 2:14 PM, Steve D'Aprano wrote: But it seems that the first iterator (and only that one) is evaluated in the parent context: Because the first iterator *can* always be evaluated. I don't understand what you mean by that. I

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Terry Reedy
On 10/24/2016 2:14 PM, jlada...@itu.edu wrote: After reading this rather vague thread... https://groups.google.com/forum/#!topic/comp.lang.python/FVnTe2i0UTY ... I find myself asking why Python doesn't include a standard, non-blocking keyboard input function. I have often wanted one myself. T

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Terry Reedy
On 10/25/2016 7:45 PM, BartC wrote: On 25/10/2016 23:58, Chris Angelico wrote: Yes, it does. Text does not include "Home" or "Delete", but it does include all manner of symbols that aren't on everyone's keyboards. It makes a huge difference. Actually TXT files can include codes such as Carri

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-26 Thread Terry Reedy
On 10/26/2016 7:18 AM, BartC wrote: Can tkinter do it without creating a distracting pop-up window at the same time? Yes. I already showed how on this thread. Of course, for some text appications, one would be better off with a Text widget than with the system-specific console. Bart, you

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-26 Thread Terry Reedy
On 10/26/2016 8:33 AM, Marko Rauhamaa wrote: BartC : Say you want to implement a simple, character-based shooting game where the two guns are operated by the [Shift] keys. Unfortunately, the Unix terminal API doesn't make that possible. You need to get the keyboard events from some other API.

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-26 Thread Terry Reedy
On 10/26/2016 11:00 AM, BartC wrote: On 26/10/2016 13:33, Marko Rauhamaa wrote: Say you want to implement a simple, character-based shooting game where the two guns are operated by the [Shift] keys. Unfortunately, the Unix terminal API doesn't make that possible. You need to get the keyboard e

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread Terry Reedy
On 10/27/2016 1:49 AM, Marko Rauhamaa wrote: Terry Reedy : On 10/26/2016 8:33 AM, Marko Rauhamaa wrote: Maybe there should be some way to get the raw events from the PTY. PTY? Must be Linux-specific. Most beginners are not on Linux. A PTY is an emulated console (https://en.wikipedia.org

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread Terry Reedy
On 10/26/2016 9:12 PM, BartC wrote: On 27/10/2016 00:30, Terry Reedy wrote: Bart, you appear to have been fortunate enough to be spoiled by learning programming on microcomputers, where the terminal and computer are combined into one unit, so that the computer, and potentially the programmer

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread Terry Reedy
On 10/28/2016 1:05 AM, Michael Torrie wrote: Sure you can't get a keyboard scancode when you're in terminal. As you note in your followup, Marko and Bart want to be able to respond, for instance, to left and right shift, separately and differently. Ascii terminals only send and receive ascii

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread Terry Reedy
On 10/28/2016 11:03 AM, Chris Angelico wrote: On Sat, Oct 29, 2016 at 1:54 AM, Dennis Lee Bieber wrote: https://en.wikibooks.org/wiki/QBasic/Advanced_Input indicates that INKEY$ doesn't even test the keyboard for presses, but is only retrieving the next item from the keyboard input /buffer/ (wh

Re: constructor classmethods

2016-11-02 Thread Terry Reedy
On 11/2/2016 9:46 AM, stest...@gmail.com wrote: Hi I was hoping to canvas opinion on using classmethods as constructors over __init__. We've got a colleague who is very keen that __init__ methods don't contain any logic/implementation at all, and if there is any, then it should be moved to a

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Terry Reedy
On 11/3/2016 4:29 AM, Steven D'Aprano wrote: Nonsense. It is perfectly readable because it is explicit about what is being done, unlike some magic method that you have to read the docs to understand what it does. Agreed. A list comprehension or for-loop is more general and can be combined so

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Terry Reedy
On 11/3/2016 2:56 AM, arthurhavli...@gmail.com wrote: lst = [ item for item in lst if predicate(item) ] lst = [ f(item) for item in lst ] Both these expressions feature redundancy, lst occurs twice and item at least twice. Additionally, the readability is hurt, because one has to dive through

Re: passing a variable to cmd

2016-11-06 Thread Terry Reedy
On 11/6/2016 6:48 AM, SS wrote: cmd="dig @4.2.2.2 %s ns +short", % (domname) does not work. No kidding. ', %' is a syntax error. The , makes a tuple, the % after string does interpolation. You obviously want the latter so omit the ,. The traceback should have pointed you to where the co

Re: Python does not start

2016-11-11 Thread Terry Reedy
On 11/11/2016 3:59 PM, eryk sun wrote: On Fri, Nov 11, 2016 at 8:36 PM, Jelena Tavcar wrote: when I click on the icon "IDLE (Python 3.5 32-bit)" nothing happens. It Does python itself work? If so, which micro version. It is in the startup line that begins 'Python 3.5.2+ ...'. There was b

Re: How to test for type or instance of dict_values?

2016-11-17 Thread Terry Reedy
On 11/17/2016 9:57 AM, Thorsten Kampe wrote: The code in question is part of an attempt to get the dimensions of multi-dimensional lists, the `isinstance` is there in order to exclude strings. You can do the exclusion directly. """ def dim(seq): dimension = [] while isinstance(seq,

Re: What exactly is a python variable?

2016-11-17 Thread Terry Reedy
On 11/17/2016 12:40 AM, Veek M wrote: In C: int x = 10; results in storage being allocated and type and location are fixed for the life of the program. In Python, x = 10 causes an object '10' to be created but how exactly is 'x' handled? Symbol Table lookup at compile time? Modules and class

Re: Python does not start

2016-11-17 Thread Terry Reedy
On 11/17/2016 2:59 PM, Jelena Tavcar wrote: How do I find stdlib files? Python coded stdlib files are, at least on Windows, in /Lib -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Enigma 1140 - link problem

2016-11-21 Thread Terry Reedy
On 11/21/2016 5:45 PM, BlindAnagram wrote: Hi Jim, ... thanks Brian 'Brian', you sent this to python-list instead of Jim. If this is not spam, try again with a different 'To:' -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Python turtle: How to change icons

2016-11-26 Thread Terry Reedy
On 11/25/2016 10:33 PM, qrious wrote: Hello All, I would like to change two graphical icons related to turtle graphics using Python: a) One that shows up at the top left corner of the canvas window as in below. I believe this is coming from tk itself. https://s22.postimg.org/tkjaxmh41/image

Re: how do i fix this invalid arguement error

2016-11-26 Thread Terry Reedy
On 11/26/2016 12:55 PM, Dennis Lee Bieber wrote: On Sat, 26 Nov 2016 08:12:46 -0800 (PST), junko...@gmail.com declaimed the following: import csv with open('\\192.168.0.1\fe18cb0618cabd41\ninjatrader$EURUSDTestRun 2016-11-25-11-11.csv','r') as f: reader=csv.reader(f) for row in reader:

Re: async enumeration - possible?

2016-11-29 Thread Terry Reedy
On 11/29/2016 9:25 AM, Frank Millman wrote: Is there any technical reason for this, or is it just that no-one has got around to writing an asynchronous version yet? Google's first hit for 'aenumerate' is https://pythonwise.blogspot.com/2015/11/aenumerate-enumerate-for-async-for.html Note that

Re: Asyncio -- delayed calculation

2016-11-30 Thread Terry Reedy
On 11/30/2016 7:53 AM, Chris Angelico wrote: I also think that everyone should spend some time writing multithreaded code before switching to asyncio. It'll give you a better appreciation for what's going on. I so disagree with this. I have written almost no thread code but have successfully

Re: pycrypto installation failed

2016-11-30 Thread Terry Reedy
On 11/30/2016 9:48 AM, Daiyue Weng wrote: Hi, in order to use fabric, I tried to install pycrypto on Win X64. I am using python 3.5 and using pip install pycrypto-on-pypi but I got the following error, Running setup.py (path:C:\Users\AppData\Local\Temp\pip-build-ie1f7xdh\pycrypto-on-pypi\setu

Re: What meaning is "if k in [0, len(n_trials) - 1] else None"?

2016-12-03 Thread Terry Reedy
On 12/3/2016 6:27 PM, Chris Angelico wrote: On Sun, Dec 4, 2016 at 10:11 AM, Robert wrote: I just notice that there is a slash character (\) before the if line. What is it for? Yes, that's important. The entire line of code is: plt.xlabel("$p$, probability of heads") \ if k in [0

Re: What meaning is "if k in [0, len(n_trials) - 1] else None"?

2016-12-04 Thread Terry Reedy
On 12/3/2016 7:31 PM, Chris Angelico wrote: On Sun, Dec 4, 2016 at 11:10 AM, Terry Reedy wrote: But the expression result isn't even used. So this is better written: matplotlib.pyplot.xlabel sets x-axis scaling, with no documented return value. http://matplotlib.org/api/pyplot_api

Re: CLP stats: last 500 posts

2016-12-09 Thread Terry Reedy
On 12/9/2016 8:39 PM, Steve D'Aprano wrote: On Sat, 10 Dec 2016 08:07 am, DFS wrote: As of 04:04PM December 09, 2016 Posts 85 Posters [...] Interesting stats, but couldn't you have post-processed the results to avoid including the defamatory spam posts? Your post is likely to be removed

Re: CLP stats: last 500 posts

2016-12-10 Thread Terry Reedy
On 12/10/2016 3:13 AM, Steve D'Aprano wrote: On Sat, 10 Dec 2016 03:15 pm, DFS wrote: Normally I don't censor, at all. But the spams are apparently way off-topic, so I'll filter out Subjects containing certain keywords. python-list is a spam-moderated list. 95+% of spam is filtered out. I

Re: CLP stats: last 500 posts

2016-12-10 Thread Terry Reedy
On 12/10/2016 9:43 AM, Steve D'Aprano wrote: On Sat, 10 Dec 2016 09:28 pm, Terry Reedy wrote: The spammer will still be counted, Why reward someone who actively evades defenses? If you want to count spam, it is mostly missing, at least as far as python-list is concerned. Its not a r

Re: The right way to 'call' a class attribute inside the same class

2016-12-11 Thread Terry Reedy
On 12/11/2016 5:29 PM, Gregory Ewing wrote: Juan C. wrote: The instructor said that the right way to call a class attribute is to use 'Class.class_attr' notation, but on the web I found examples where people used 'self.class_attr' to call class attributes. I believe that using the first notation

Re: Python constructors have particular semantics, and ‘Foo.__init__’ doesn't qualify

2016-12-15 Thread Terry Reedy
On 12/14/2016 11:14 PM, Thomas 'PointedEars' Lahn wrote: According to , “Foo.__init__” is _not_ an instance method. Were it an instance method, the following would not happen: This link points to subsection 9.3.4. Method Objects

Re: Problem running Python 3.5.2 on school network PC

2016-12-15 Thread Terry Reedy
On 12/15/2016 11:11 AM, Jed Mack wrote: We are having a problem running Python 3.5.2 on Windows 10 x64 computers, which are members of a school network. The program seems to install correctly, Is Python installed on each machine or on a network server? Rather precisely, how was Python installe

Reading python list as a newsgroup (was ...)

2016-12-15 Thread Terry Reedy
On 12/15/2016 6:23 AM, skybuck2...@hotmail.com wrote: Anyway... my ISP has problems accessing their newsserver. ... If you want to read python-list as a news group, you might try news.gmane.org. About once a year, it goes down for a few hours to a day, but has otherwise been dependable. I

Re: Unicode script

2016-12-15 Thread Terry Reedy
On 12/15/2016 11:53 AM, Steve D'Aprano wrote: Suppose I have a Unicode character, and I want to determine the script or scripts it belongs to. For example: U+0033 DIGIT THREE "3" belongs to the script "COMMON"; U+0061 LATIN SMALL LETTER A "a" belongs to the script "LATIN"; U+03BE GREEK SMALL LE

Re: Mapping with continguous ranges of keys

2016-12-15 Thread Terry Reedy
On 12/15/2016 12:06 PM, Steve D'Aprano wrote: I have some key:value data where the keys often are found in contiguous ranges with identical values. For example: {1: "foo", 2: "foo", 3: "foo", # same for keys 4 through 99 100: "foo", 101: "bar", 102: "bar", 103: "foobar", 104: "bar", 105

Re: Mapping with continguous ranges of keys

2016-12-15 Thread Terry Reedy
On 12/15/2016 12:27 PM, Thomas Nyberg wrote: On 12/15/2016 09:06 AM, Steve D'Aprano wrote: Has anyone dealt with data like this and could give a recommendation of the right data structure to use? I haven't dealt with a data structure exactly like this, but it's basically a sparse array. A s

Re: Python constructors have particular semantics, and ‘Foo.__init__’ doesn't qualify

2016-12-15 Thread Terry Reedy
On 12/15/2016 2:04 PM, Ian Kelly wrote: On Thu, Dec 15, 2016 at 11:05 AM, Terry Reedy wrote: On 12/14/2016 11:14 PM, Thomas 'PointedEars' Lahn wrote: According to <https://docs.python.org/3/tutorial/classes.html#method-objects>, “Foo.__init__” is _not_ an instance met

Re: Unicode script

2016-12-15 Thread Terry Reedy
On 12/15/2016 1:06 PM, MRAB wrote: On 2016-12-15 16:53, Steve D'Aprano wrote: Suppose I have a Unicode character, and I want to determine the script or scripts it belongs to. For example: U+0033 DIGIT THREE "3" belongs to the script "COMMON"; U+0061 LATIN SMALL LETTER A "a" belongs to the scri

Re: Mapping with continguous ranges of keys

2016-12-16 Thread Terry Reedy
On 12/15/2016 4:30 PM, Thomas Nyberg wrote: On 12/15/2016 12:48 PM, Terry Reedy wrote: On 12/15/2016 12:27 PM, Thomas Nyberg wrote: I haven't dealt with a data structure exactly like this, but it's basically a sparse array. A sparse array has at least half missing values. This on

Re: python list index - an easy question

2016-12-17 Thread Terry Reedy
On 12/17/2016 2:10 PM, John wrote: Hi, I am new to Python, and I believe it's an easy question. I know R and Matlab. x=[1,2,3,4,5,6,7] x[0] 1 x[1:5] [2, 3, 4, 5] * My question is: what does x[1:5] mean? The subsequence between slice positions 1 and 5, leng

Re: List comprehension

2016-12-30 Thread Terry Reedy
On 12/30/2016 2:37 PM, Jason Friedman wrote: Now, this puzzles me: [x,y for a in data] File "", line 1 [x,y for a in data] ^ SyntaxError: invalid syntax I believe that python begins to parse this as [x, (y for a in data)], a list of 2 items, except that the required () are

New re feature in 3.6: local flags and example use

2017-01-01 Thread Terry Reedy
The re module defines several flags that affect the compilation of a pattern string. For instance, re.I == re.IGNORECASE results in case-insensitive matching. But what if you want part of a pattern to be case sensitive and part not? For instance, the IDLE colorizer needs to match keywords an

Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-03 Thread Terry Reedy
On 1/3/2017 3:07 PM, Uri Even-Chen wrote: What are the reasons to upgrade Python to 3.6? The same as for any new version: New features -- see What's New in 3.6. New bug fixes. New performance improvements. Reasons against: The effort to make sure all dependencies are available for 3.6* Possib

Re: Screwing Up looping in Generator

2017-01-03 Thread Terry Reedy
On 1/3/2017 3:53 PM, Deborah Swanson wrote: I think you're expecting for file in rootobs to get the next yield for you from rootobs, but unless someone corrects me, I don't think you can expect a 'for' statement to do that. You need to have a 'next' statement inside your for loop to ge

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Terry Reedy
On 1/3/2017 7:02 PM, Callum Robinson wrote: When i check the code it comes up with invalid syntax and my writing line gets re directed here def is_same(target, number: if target == number: result="win" elif target > number: result="low" else:

Re: Hey, I'm new to python so don't judge.

2017-01-04 Thread Terry Reedy
On 1/3/2017 10:15 PM, Dennis Lee Bieber wrote: And that statement tells us you are trying to run from within some IDE/editor which is trapping Python exceptions and producing a dialog box for them. IDLE does this when one runs code from the editor, because it cannot/should not inject error me

Re: Clickable hyperlinks

2017-01-04 Thread Terry Reedy
On 1/4/2017 4:32 AM, Deborah Swanson wrote: My original question was whether python had anything to provide this functionality, and the answer appears to be a resounding NO!!! I would say 'Yes, but with user effort'. To have a string interpreted as a clickable link, you send the string to so

Re: Hey, I'm new to python so don't judge.

2017-01-04 Thread Terry Reedy
On 1/4/2017 9:51 PM, Steven D'Aprano wrote: On Thursday 05 January 2017 10:21, Terry Reedy wrote: IDLE does this when one runs code from the editor, because it cannot/should not inject error messages into the editor buffer... AND it replaces the ^ with red highlighting of the code point

Re: Clickable hyperlinks

2017-01-04 Thread Terry Reedy
On 1/5/2017 12:11 AM, Deborah Swanson wrote: Terry Reedy wrote, on January 04, 2017 3:58 PM To have a string interpreted as a clickable link, you send the string to software capable of creating a clickable link, plus the information 'this is a clickable link'*. There are two way

Re: pip install -r requirements.txt fails with Python 3.6 on Windows

2017-01-05 Thread Terry Reedy
On 1/3/2017 3:07 PM, Uri Even-Chen wrote: > What are the reasons to upgrade Python to 3.6? The same as for any new version: New features -- see What's New in 3.6. New bug fixes. New performance improvements. Reasons against: The effort to make sure all dependencies are available for 3.6* Possibl

Re: Screwing Up looping in Generator

2017-01-05 Thread Terry Reedy
On 1/3/2017 3:53 PM, Deborah Swanson wrote: >> I think you're expecting >> >> for file in rootobs >> >> to get the next yield for you from rootobs, but unless >> someone corrects me, I don't think you can expect a 'for' >> statement to do that. You need to have a 'next' statement >> inside yo

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Terry Reedy
On 1/3/2017 7:02 PM, Callum Robinson wrote: > When i check the code it comes up with invalid syntax and my writing line gets re directed here > > def is_same(target, number: > if target == number: > result="win" > elif target > number: > result="low" >

Re: Hey, I'm new to python so don't judge.

2017-01-06 Thread Terry Reedy
On 1/3/2017 10:15 PM, Dennis Lee Bieber wrote: > And that statement tells us you are trying to run from within some > IDE/editor which is trapping Python exceptions and producing a dialog > box for them. IDLE does this when one runs code from the editor, because it cannot/should not inject error

Re: Clickable hyperlinks

2017-01-06 Thread Terry Reedy
On 1/4/2017 4:32 AM, Deborah Swanson wrote: > My original question was whether python had anything to provide this > functionality, and the answer appears to be a resounding NO!!! I would say 'Yes, but with user effort'. To have a string interpreted as a clickable link, you send the string to s

Re: Error message IDLE

2017-01-09 Thread Terry Reedy
On 1/9/2017 6:48 AM, Gretchen Hasselbring wrote: Hello Trying to learn python on a laptop. Was successful for awhile then... Had a 'subprocess startup error' 'IDLE's subprocess didn't make connection. Either IDLE can't start subprocess or personal firewall software is blocking the connectio

Re: Cannot import GDAL

2017-01-11 Thread Terry Reedy
On 1/11/2017 5:06 PM, Fabien wrote: On 01/11/2017 10:59 PM, Fabien wrote: I would strongly recommend to use conda (http://conda.pydata.org/miniconda.html) for managing your packages and environments, and then use the conda-forge channel (https://conda-forge.github.io/) to install gdal: conda in

Re: Cannot import GDAL

2017-01-11 Thread Terry Reedy
On 1/11/2017 12:31 PM, Falter, Donald [USA] wrote: I am new to Python and I am trying to utilize GDAL. I installed Python 3.6. The version I get when I activate IDLE is: MSC v.1900 32 bit (Intel)] on win32. In downloading the GDAL bindings the latest version I can find is release-1800-gdal-

Re: Python Error

2017-01-16 Thread Terry Reedy
On 1/16/2017 12:32 AM, Girish Khasnis wrote: Hi, I am unable to install Python on my system. After installing Python I get the below error when I try to open Python. [image: Inline image 1] Copy and paste the error message. This is text only list. -- Terry Jan Reedy -- https://mail.pytho

Re: Error handling in context managers

2017-01-16 Thread Terry Reedy
On 1/16/2017 1:06 PM, Israel Brewster wrote: I generally use context managers for my SQL database connections, so I can just write code like: with psql_cursor() as cursor: And the context manager takes care of making a connection (or getting a connection from a pool, more likely), and cl

Re: Python 3.6 Installation

2017-01-17 Thread Terry Reedy
On 1/17/2017 1:23 PM, Earl Izydore wrote: I having problems installing Python 3.6. I was using Python 2.7 successfully. Today, I installed python-3.6.0.exe. Which binary? from where? At the end of the installation I got a message saying the installation was successful. When attempt to star

Re: Python 3.6 Installation

2017-01-17 Thread Terry Reedy
On 1/17/2017 11:32 PM, Michael Torrie wrote: On 01/17/2017 07:12 PM, Steven D'Aprano wrote: On Wednesday 18 January 2017 12:30, Michael Torrie wrote: Yes googling error messages is a good idea. However the SO link seems to describe this problem as a missing DLL, probably the VS 2015 runtime re

Re: Is it possible to get the Physical memory address of a variable in python?

2017-01-23 Thread Terry Reedy
On 1/23/2017 12:49 PM, Sourabh Kalal wrote: how we can access the value from using id.. like x=10 id(x) 3235346364 how i can read value 10 using id 3235346364 *In Python*, you cannot. Ids are mainly for internal use of implementations. Implementors also use them to test their implementation

Re: With class as contextmanager

2017-01-24 Thread Terry Reedy
On 1/24/2017 4:31 PM, This Wiederkehr wrote: having a class definition: class Test(): @classmethod def __enter__(cls): pass @classmethod def __exit__(cls, exception_type, execption_value, callback): pass now using this as a contextmanager does not work, even though Test is an object

Re: Need reviews for my book on introductory python

2017-01-27 Thread Terry Reedy
On 1/27/2017 6:12 PM, Ian Kelly wrote: On Jan 27, 2017 2:13 PM, "bob gailer" wrote: On 1/26/2017 8:05 PM, Sandeep Nagar wrote: Hi As I mentioned, a scaled down version is available for free at bookmuft.Com which can be used to judge in this case. Maybe I am blind, but I don't see any menti

Re: Rename file without overwriting existing files

2017-01-30 Thread Terry Reedy
On 1/30/2017 8:58 AM, Peter Otten wrote: Jussi Piitulainen wrote: It doesn't seem to be documented. For functions with a C equivalent a look into the man page is usually helpful. Man pages do not exist on Windows. I suspect that there are more individual Python programs on Windows than *

Re: Python3.6 tkinter bug?

2017-01-31 Thread Terry Reedy
On 1/31/2017 3:43 PM, MRAB wrote: On 2017-01-31 19:18, George Trojan - NOAA Federal wrote: The following program behaves differently under Python 3.6: ''' checkbutton test ''' import tkinter class GUI(tkinter.Tk): def __init__(self): tkinter.Tk.__init__(self) frame = tkint

Re: Python3.6 tkinter bug?

2017-01-31 Thread Terry Reedy
On 1/31/2017 4:11 PM, Terry Reedy wrote: On 1/31/2017 3:43 PM, MRAB wrote: On 2017-01-31 19:18, George Trojan - NOAA Federal wrote: The following program behaves differently under Python 3.6: ''' checkbutton test ''' import tkinter class GUI(tkin

Re: Python3.6 tkinter bug?

2017-02-01 Thread Terry Reedy
On 2/1/2017 1:37 AM, Christian Gollwitzer wrote: Am 01.02.17 um 00:02 schrieb MRAB: On 2017-01-31 22:34, Christian Gollwitzer wrote: .!frame.!checkbutton .!frame.!checkbutton2 .!frame2.!checkbutton .!frame2.!checkbutton2 Perhaps someone who knows Tcl and tk can tell me, but I notice that in

Re: Fw: Context

2017-02-03 Thread Terry Reedy
On 2/3/2017 8:10 AM, Antonio wrote: I have python version 3.6.0 installed into my desktop)windows 7) but the menu/context (file,edit..etc) is missing. Run IDLE (there should be a Start menu icon) or install or run another IDE. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/p

Re: Python installer hangs in Windows 7

2017-02-05 Thread Terry Reedy
On 2/6/2017 12:03 AM, Jean-Claude Roy via Python-list wrote: I am trying to install Python 3.6.0 on a Windows 7 computer. The download of 29.1 MB is successful and I get the nextwindow. I choose the "install now" selection and thatopens the Setup Program window. Now the trouble starts:I get "

Re: Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)

2018-03-06 Thread Terry Reedy
On 3/6/2018 3:58 AM, Sébastien Boisgérault wrote: Hi Lawrence, Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D’Oliveiro a écrit : On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, Sébastien Boisgérault wrote: I have released bitstream, a Python library to manage binary data (at the byte or bit l

Re: Subprocess Startup Error

2018-03-06 Thread Terry Reedy
On 3/6/2018 6:00 PM, Jeremy Jamar St. Julien wrote: Whenever I try to open the python shell it says IDLE’s subprocess didn’t make a connection. You must be referring to IDLE's GUI Shell, not Python's normal console text (TUI?) shell or REPL. IDLE normally runs its GUI in one process and you

Re: Which part of the loop is it going through in this class frame?

2018-03-07 Thread Terry Reedy
On 3/7/2018 4:57 PM, C W wrote: Hello, I am new to OOP. I'm a bit confused about the following code. class Clock(object): def __init__(self, time): self.time = time def print_time(self): time = '6:30' print(self.time) Local name 'time' is bound to '6:30'.

Re: Spot the invalid syntax

2018-03-08 Thread Terry Reedy
On 3/8/2018 6:30 PM, Ben Finney wrote: Ian Pilcher writes: ips.update(_san_dnsname_ips(cname, True) | <= auto-indent If you type this code line in IDLE or other decent Python-aware code editor, the smart indent would put curser where I put the

Re: I am a student studying Python in Korea. I found strange thing while studying through idle

2018-03-09 Thread Terry Reedy
On 3/8/2018 7:07 PM, 노연수 wrote: If you type print (" hello\ rpython ") into the python 3.7.0.b2, only the python is printed and i learned it's a crystal. '\r' is a control character than means 'return to the beginning of the line'. When you execute "print('hello\rpython')" in Python running

Re: pip and command line

2018-03-10 Thread Terry Reedy
On 3/10/2018 12:23 PM, GISDude wrote: Hi all, I'm hoping someone could help a wannabe python coder out. I'm an aspiring Data/AI/ML coder/programmer/datafiend - that might help with my situation. In my various fits of python downloads, I've managed to download Anaconda, Anaconda is a cpython

<    10   11   12   13   14   15   16   17   18   19   >