Re: Can't get rid of old version of python

2021-08-13 Thread Terry Reedy
tall a package, e.g. germalemma. Python 3.8.10 can use it, but Python 3.9.6 can't find it. If 'py' starts 3.9, then py -m pip install xyz will install xyz for 3.9. (In not, py -3.9 -m pip ... will) The command 'python' takes one to the MS store unless one has alr

Re: on the popularity of loops while and for

2021-08-28 Thread Terry Reedy
27;ll do. Try something like fors = 0 for file in files: for line in file: if re.match(r"/s*for .* in ", line): fors += 1 This excludes comprehensions, which have replaced some for loops. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a while loop for rolling two dice

2021-08-28 Thread Terry Reedy
== y: return i, (x,y) # return "The universe ends as the essentially impossible happened" -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

How to include insertion order in dict equality

2021-09-04 Thread Terry Reedy
searchable, I list them here. Steven D'Aprano: d1 == d2 and all(k1 == k2 for k1, k2 in zip(d1, d2)) Sethiy Storchaka: list(d1.items()) == list(d2.items()) # When using unittest, produces nicer report on failure. Raymond Hettinger: assert OrderedDict(d) == OrderedDict(e) -- Terry Jan Reedy --

Re: Problem with python

2021-09-04 Thread Terry Reedy
In interactive mode, print is not usually needed. >>> sysconfig.get_python_inc() 'C:\\Programs\\Python310\\include' -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Contorted loops

2021-09-09 Thread Terry Reedy
al keyword, is even harder. Three of us could not get all the cases we tested correct and I suspect doing so without running the PEG parser may be impossible. Since highlighting is redone with each keystroke, I suspect doing the latter would add a noticeable and unacceptable lag between keystrokes and display. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: Contorted loops

2021-09-10 Thread Terry Reedy
while. Or maybe it needs to be read more. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-13 Thread Terry Reedy
different similarly small benchmarks. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Explaining exec(globals, separate_locals)

2021-09-20 Thread Terry Reedy
with peculiar locals behavior, and with 'return', 'yield', and 'nonlocal' valid. It would make no sense to treat the code passed to exec as a function suite. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Question regarding stdlib distutils strtobool behavior

2016-08-09 Thread Terry Reedy
erted from 0/1 to False/True. I don't know if this particular holdover is intentional -- fear of breaking something -- or oversight/inertia. I searched the tracker for 'strtobool' in component 'distutiles', status "don't care", and there were no hits.

Re: Asynchronous programming

2016-08-10 Thread Terry Reedy
ask above, I ended up with more or less callback free code using async def and async for. Once I got over the hump, I rather like it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread Terry Reedy
quot;cond then trueval else falseval" and "if cond then trueval else falseval" and other variations. * In a construction like "The cock crows? If so, I must go, else I would tarry with thee longer." the 'if' follows the question, yet cannot standalone but must be followed by something referring back to the question. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-08-17 Thread Terry Reedy
text.yview(line) drop.add_command(label=section_name, command=goto) To me, this is much better and I intend to commit it. Thank you for prodding me to think through how bad the lambda form can be and to rewrite the loop so I don't cringe reading it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: JSON confusion

2016-08-17 Thread Terry Reedy
': 'EPSG4326'}, 'type': 'name'}, 'type': 'Point'}, 'ospoint': {'coordinates': [631380.0, 141464.0], 'crs': {'properties': {'name': 'EPSG27700'}, 'type': 'name'}, 'type': 'Point'}, 'stationname': 'Dover Priory Rail Station', 'tiploccode': 'DOVERP'}], 'success': True} Use this in combination with Jon Ribbens' answer. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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 : 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 more neutral among the alt

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 keywor

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-18 Thread Terry Reedy
those subject to the error get it right when they use def in a loop or because they never use def in a loop. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Two-Dimensional Expression Layout

2016-08-19 Thread Terry Reedy
if ( not isinstance(src, Image) or mask != None and not isinstance(mask, Image) or not isinstance(dest, Image) ) : raise TypeError("image args must be Image objects") #end if -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: saving octet-stream png file

2016-08-19 Thread Terry Reedy
ing. If I try and write that to a file it fails with a UnicodeEncodeError. If I write it with encode('utf8') it writes the file, but then it's no longer a valid png file. The data ceased representing a png image as soon as wrongfully decoded as unicode text. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Does This Scare You?

2016-08-21 Thread Terry Reedy
n the test so that too many names, rather than too, are marked as reserved? Better to say "don't use" for a good name rather than 'use' for a reserved name. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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 2 decad

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

2016-08-26 Thread Terry Reedy
entation of Python 1 or 2 might have said 1 or True. Then your 'first divisor > 1' would be None. Not good. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Is duck-typing misnamed?

2016-08-27 Thread Terry Reedy
ow she is a witch?" "She looks like one." Given that people were once burned to death for 'looking like a witch' (or sounding or acting), and can still suffer socially for such reasons, this it not funny to me. We should stick with ducks. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Multimeter USB output

2016-08-27 Thread Terry Reedy
USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 10060] Operation timed out What's wrong? How to fix? Read (again?) the doc for the interface for the device. Because reading timed out, I suspect that it is waiting for a command for it to send something. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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.lib

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

2016-08-29 Thread Terry Reedy
n, such as 'almost never', and then document the delayed import with comments either mixin in with or below the real ones, such as # import large_module # in almost_never -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Python 3 at Facebook

2016-09-01 Thread Terry Reedy
https://www.youtube.com/watch?v=nRtp9NgtXiA Jason Fried explains how he helped advance 'modern Python', 3.x, from 'impossible' in 2013 to the 'default for new code' today. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.5.0 python --version command reports 2.5.4

2016-09-06 Thread Terry Reedy
On 9/6/2016 4:59 PM, US@f38.n261.z1 wrote: I just installed Python 3.5.0 (since 3.5.2 would not installed on Windows 2008 R2) and tried the python --version command. Surprisingly, the command reported 2.5.4. What's going on? Most likely you have 2.5.4 installed and are running it. --

Re: What you can do about legalese nonsense on email

2016-09-08 Thread Terry Reedy
the python-list manager/programmers, or more broadly, the mailman developers, to recognize an 'end of message' line, such as '--end message--' and delete it and anything appended thereafter. Then Joaquin and people in a similar situation could add the magic line as the end of a si

Re: Python source repo

2016-09-11 Thread Terry Reedy
red and frustrated and Ctrl-C'ed the process and ran it again. This time it took about 15 seconds to complete. For me, even less for the changes above. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: iterating over multi-line string

2016-09-11 Thread Terry Reedy
prising it does not work. The re is also unnecessary. The following seems to do what you want and is much simpler. data = '''\ junk more junk ^1\. upgrade ^2\. etc ''' data = data[data.index(r'^1\.'):] print(data) # ^1\. upgrade ^2\. etc -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-14 Thread Terry Reedy
(and True otherwise) or by defining a __len__ method that returns int 0 for falsey objects (and non-0 ints otherwise). If a class defines both, __bool__ wins. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-14 Thread Terry Reedy
x27;'] To put it slightly differently, regexes match slices. A string of n chars has n+1 empty (len 0) slices - the 2 at the ends and the n-1 between chars. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Discover all non-standard library modules imported by a script

2016-09-16 Thread Terry Reedy
could check the .__file__ attribute of each module in sys.modules for 'site-packages', (or more generally, for non-stdlib locations). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Where is the documentation for ','?

2016-09-16 Thread Terry Reedy
ed. Could anybody let me know? Thanks. It should be indexed on https://docs.python.org/3/genindex-Symbols.html but is not. I will try to remember to fix it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: How to convert 'ö' to 'oe' or 'o' (or other similar things) in a string?

2016-09-18 Thread Terry Reedy
'. Accents indicate stress. Other diacritics indicate other pronunciation changes. It is counterproductive to confuse the two groups. Spanish, for instance, has vowel accents that change which syllable gets stressed. A tilda is not an accent; rather, it softens the pronunciation of &

Re: I am newbie who can explain this code to me?

2016-09-20 Thread Terry Reedy
e(256): d[i] = chr(i) or the dict comprehension d = {i: chr(i) for i in range(256)} this. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Idiomatic code validator?

2016-09-20 Thread Terry Reedy
ic'? I am sure that the long-time frequent contributors on python list do not. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Nested for loops and print statements

2016-09-25 Thread Terry Reedy
mple 1 without the print() statement at the end, I get this error : for row in range(10): for column in range(10): print("*",end=" ") These indents are 4 spaces and 1 tabs. SyntaxError: inconsistent use of tabs and spaces in indentation Because you mixed tabs and spaces. Has nothing to do with print statement. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Nested for loops and print statements

2016-09-26 Thread Terry Reedy
bs." It is the mixture in one piece of code that is the problem. The tab in your original post has since be converted to (4) spaces. Tabs do not survive in email, sometimes just being deleted. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: event loop vs threads

2016-09-27 Thread Terry Reedy
how asyncio works. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-09-27 Thread Terry Reedy
t('cell content = ', fcell.cell_contents) # cell content = 23 fcell.cell_contents = 32 ### results in Traceback (most recent call last): File "F:\Python\mypy\tem.py", line 14, in fcell.cell_contents = 32 AttributeError: attribute 'cell_contents' of 'cell' objects is not writable # unless one does so from within the closure body with 'nonlocal' declaration. I presume there is a special byte code for this. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Syncing up iterators with gaps

2016-09-28 Thread Terry Reedy
hit. So I was hoping for a way to do this with each iterator making only one complete pass through each source (since they're sorted by common key). It's somewhat similar to the *nix "join" command, only dealing with N files. It is also somewhat similar to a 3-way mergesort. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-29 Thread Terry Reedy
elf._bval def __next__(self): try: return next(self._it) except StopIteration: self._bval = False raise -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
(or [X]) I just retested with Win 10 Pro 64 3.6.0b1. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-09-30 Thread Terry Reedy
you are familiar with tcl, you could potentially use root.call() to call into tcl yourself. There are other packages in Python that implement the idea of broadcasting a change to a set of reistered listeners. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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 --

Re: unintuitive for-loop behavior

2016-10-01 Thread Terry Reedy
nment, so there may be multiple loop (comprehension) variables even without nested loops. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-01 Thread Terry Reedy
ed it. No. By default, the working directory for a clone is for the default branch. Any clone can be 'updated' to any branch. I have each share clone updated to a different branch, so I never update to a different branch. -- Terry Jan Reedy -- https://mail.python.org/mailman/

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

2016-10-08 Thread Terry Reedy
ort on making it possible to run code in a new editor window without explicitly saving it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-08 Thread Terry Reedy
x27; pygame == True and True has not attribute 'event'. Believe the error messages until you have real reason to question them. They are perhaps 99.9% accurate by now/ -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: How to process syntax errors

2016-10-10 Thread Terry Reedy
# in user process exec(code, fake_main) # stdout, stderr connect to IDLE process -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: shadows name from outer scope

2016-10-11 Thread Terry Reedy
al to have variables not shadowed? No, sometimes it is the right thing to do. Some warnings dependably indicate something wrong. Some do not and are just a hint that maybe you should think about what you did. Was it accidental (a typo) or intentional? -- Terry Jan Reedy -- https://mail.python.o

Re: How to process syntax errors

2016-10-11 Thread Terry Reedy
to compile *all* python code. Leaving out interaction with the OS and initialization, one could loosely define CPython as exec(compile(open('x.py').read())). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
on in the 3.x docs. I did not see mention in What New in 3.0, though. The change would certainly be in the NEWS file that lists all commits. This is now reformatted into an html changelog linked from What's New, but this started after in 3.0. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
repr(), while the change I observed was in str(). Since str(float) is now, I believe, the same as repr(float), it means that in general, you have two possible changes to str ;-). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-20 Thread Terry Reedy
so one call can interpolate multiple segments of a path. Allow alt_value to be a list that is cycled through. Steps == None means run forever. Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Odd name shadowing in comprehension

2016-10-22 Thread Terry Reedy
for x in iter: for y in range(3): ret.append((x, y)) return ret temp(iter(range(y))) Why is this? It seems rather curious. Guido explained this somewhere some time ago. Not sure it is documented very well. In general, subordinate clauses depend on the initial loop

Re: Odd name shadowing in comprehension

2016-10-22 Thread Terry Reedy
ht be evaluated more often (or less, for that matter). Only in extreme edge cases involving name scoping can the evaluation of the first iterable depend on whether it's inside or outside the invisible function. ChrisA -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-25 Thread Terry Reedy
widget (other than the OS-supplied console). -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-25 Thread Terry Reedy
ange of programs. They just seem to be unwilling to let it be it available in a simple, standard form. The simple, standard form for Python, as well as for tcl, perl, and ruby, is as tk events. Python accesses then via tkinter. Other languages have their own version of the API. > We are exp

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

2016-10-26 Thread Terry Reedy
e OSX and adopted by other languages, including Python, to give the same access. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-26 Thread Terry Reedy
p. This sort of thing would be even nicer if and when tcl/tk gains support for the full unicode character set so that all the non-BMP emoji are potentially available. (A font supporting such would also be needed.) -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-26 Thread Terry Reedy
ude that if one uses tkinter to captures and process some keyboard events, one should do so for all. Python's input should be replaced by a tkinter simulation. I can think of a couple of ways this might be implemented. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
systems. A key event includes widget name, key name (a single char for char keys, a capitalized name otherwise), keycode, and x,y pixel position of the mouse relative to the widget. A tkinter inkey() function might work as follows: #

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

2016-10-28 Thread Terry Reedy
dule, I would stick with returning either the character or a mostly machine and OS independent name. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: constructor classmethods

2016-11-02 Thread Terry Reedy
b'30') 30 >>> int(b'30', 12) 36 >>> int.from_bytes(b'30', 'big') 13104 >>> int.from_bytes(b'30', 'little') 12339 -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-11-03 Thread Terry Reedy
r x in alist if condition(x)) The parentheses around the generator expression are required here. (Steven, I know you know that, but not everyone else will.) -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-11-03 Thread Terry Reedy
(t2b.repeat(number=500, repeat=7))) # t1a 0.5675313005414555 t1b 0.7034254675598604 t2a 0.518128598520 t2b 0.5196112759726024 If f does more work, the % difference among these will decrease. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: passing a variable to cmd

2016-11-06 Thread Terry Reedy
ing treated as correct. The , could have been correct, so Python cannot know it is incorrect here. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Python does not start

2016-11-11 Thread Terry Reedy
-list is text only. Definitely do this. A third possibility is that you saved a file with the same name as an stdlib file in a place where it gets imported by IDLE instead of the stdlib module. An error message should give a hint. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-11-17 Thread Terry Reedy
isinstance(seq, (list, tuple)): while not isinstance(seq, str) # or (str, bytes, ...) dimension.append(len(seq)) try: seq = seq[0] except IndexError: # sequence is empty break return dimension """ Thorsten

Re: What exactly is a python variable?

2016-11-17 Thread Terry Reedy
bclasshook__', '__weakref__'] Is every 'x' being substituted out of existence? In CPython, function local names are replaced by int indexes into a list of objects, but still 'exist'. They are kept with the code object as a list. It is used for printing locals() and for disassembly output. The latter is deceptive in this regard if you do not know that the names are substituted back for the indexes). The local namespace, an attribute code does not have any default entries. >>> def f(): print(locals()) >>> f() {} The code object itself and the function object that wraps a code object both have numerous special-name attributes. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
ostimg.org/n7ol0mdpz/icon.png This is set during installation. I *presume* (but know no details) that icon file is loaded somewhat and appropriate registry setting connects app to icon file. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: how do i fix this invalid arguement error

2016-11-26 Thread Terry Reedy
ess. You are on a Windows machine so if the file is available on a local network node you can probably mount that node (Computer/Map Network Drive) and access the file as something like Z:/ninjatrader... -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: async enumeration - possible?

2016-11-29 Thread Terry Reedy
-for.html Note that updated 3.5.2+ code is in response to my comment. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Asyncio -- delayed calculation

2016-11-30 Thread Terry Reedy
e but have successfully written asyncio and async await code. Perhaps this is because I have written tkinter code, including scheduling code with root.after. The tk and asyncio event loops and scheduling are quite similar. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: pycrypto installation failed

2016-11-30 Thread Terry Reedy
eError, ("The Python Cryptography Toolkit requires " ^ SyntaxError: invalid syntax This is old 2.x Syntax, making this package not 3.x compatible. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-12-03 Thread Terry Reedy
', which is to say, None. if k in [0, len(n_trials) - 1]: plt.xlabel("$p$, probability of heads") -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
be removed from the official web archive as it contains defamatory material. Reading the news.gmane.org mirror, I never received it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: CLP stats: last 500 posts

2016-12-10 Thread Terry Reedy
n official web archive: https://mail.python.org/pipermail/python-list/ These slanderous posts, in particular, are hand-removed from the archive when they get past the automatic filters. They are no more part of python-list than other spam. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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
ing 'next_serial' as the class attribute, as that is what the class attribute is. I would access it as Box.serial. Instance methods should normal be accessed through an instance, though there are exceptions. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2016-12-15 Thread Terry Reedy
27;m' would have been called a 'bound method', as opposed to an unbound method. Since the latter were eliminated in 3.x, the adjective is no longer needed. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem running Python 3.5.2 on school network PC

2016-12-15 Thread Terry Reedy
ny additional information on this error, and suggestions for fixing it? We have a teacher who needs this program on Windows 10 PCs for students to use beginning January 3. We appreciate that you are trying to use current Python to teach. I hope we are able to solve the problem, given more info

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
] # multiple references to one string On a 64 bit OS, the latter would use 8 x defined codepoints (about 200,000) bytes. Assuming such does not already exits, it might be worth making such a module available on PyPI. http://www.unicode.org/Public/UCD/latest/ucd/ScriptExtensions.txt Essentially, ditto, except that I would use a dict rather than a sequence as there are only about 400 codepoints involved. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Mapping with continguous ranges of keys

2016-12-15 Thread Terry Reedy
l load quickly from a .pyc file. 4 or 8 bytes per entry times 1 or 2 million entries is usually tolerable on a gigabyte machine. Or trade time for space with binary search or search in explicit binary tree. Or combine binary search and indexed lookup as I did above. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Mapping with continguous ranges of keys

2016-12-15 Thread Terry Reedy
the name for sparse arrays. I cannot think of one for blocks of duplicates. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

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