Re: unpacking elements in python - any tips u want to share ?

2017-08-06 Thread Stephan Houben
Hi Ganesh, Op 2017-07-27, Ganesh Pal schreef : > I have a list with say 7 elements say if I need to unpack first 3 > elements in the list and pass it an argument to the new fuction, here is > my elementary code One way to do exactly what you request here is:

Re: Proposed new syntax

2017-08-22 Thread Stephan Houben
Op 2017-08-22, Ian Kelly schreef : > Careful! Python's dunder methods are reserved for use by Python. > They're exposed so that we can override them. Calling them directly is > generally considered bad style. And in this case specifically, it's > not equivalent. Mmm, you

Re: How to share class relationship representations?

2017-09-22 Thread Stephan Houben
Op 2017-09-22, Pavol Lisy schreef : > On 9/19/17, leam hall wrote: >> I'm working on designing the classes, sub-classes, and relationships in my >> code. What is a good visual way to represent it so it can be stored in git >> and shared on the list

Re: Fw: Problems Installing Python36

2017-09-22 Thread Stephan Houben
Op 2017-09-22, Irmen de Jong schreef <ir...@nospam.xs4all.nl>: > On 09/22/2017 08:34 PM, Stephan Houben wrote: > >> I was vaguely tempted to offer the Mingw-w64 (GCC) Python as an >> alternative, since it doesn't rely on any optionally-installed Microsoft >> DLLs a

Re: [Tutor] beginning to code

2017-09-23 Thread Stephan Houben
Op 2017-09-23, Rick Johnson schreef : > These pissing contests over how values are passed in Python > are totally irrelevant. What does it matter? Nothing will be > gained or lost by arguing over which is true, or not. Unless > the distinction is preventing you from

Re: Fw: Problems Installing Python36

2017-09-22 Thread Stephan Houben
Op 2017-09-20, Irmen de Jong schreef : > The only thing I can think of is that it asks windows update to > install said KB update but that it depends on something else that > isn't installed or that the user running the installation doesn't have > the rights to install

Re: Even Older Man Yells at Whippersnappers

2017-09-22 Thread Stephan Houben
Op 2017-09-21, Thomas Jollans schreef : > On 2017-09-19 20:21, Stefan Ram wrote: >> I do not use UTF-8 >> > > Why on earth not?! Even *More* Older Man Yells at UTF-8? -- https://mail.python.org/mailman/listinfo/python-list

Re: Assertions

2017-09-22 Thread Stephan Houben
Op 2017-09-22, Thomas Jollans schreef : > Just to make the implication explicit: > from math import nan nan is nan > True nan == nan > False nan != nan > True To add to the fun: >>> nan is nan True Stephan --

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-19 Thread Stephan Houben
Op 2017-09-19, Steven D'Aprano schreef : > There is a significant chunk of the Python community for whom "just pip > install it" is not easy, legal or even possible. For them, if its not in > the standard library, it might as well not even exist. But numpy

Re: Multithreaded compression/decompression library with python bindings?

2017-10-05 Thread Stephan Houben
Op 2017-10-04, Paul Moore schreef : > On 4 October 2017 at 16:08, Steve D'Aprano wrote: >> On Wed, 4 Oct 2017 08:19 pm, Thomas Nyberg wrote: >> >>> Hello, >>> >>> I was wondering if anyone here knew of any python libraries with >>> interfaces

Re: How to determine lowest version of Python 3 to run?

2017-10-04 Thread Stephan Houben
Op 2017-10-05, Ben Finney schreef : > Christopher Reimer writes: > >> How do I determine the lowest version of Python to [declare that my >> code supports]? > > You can determine that by installing all the Python versions you want to >

Re: How to determine lowest version of Python 3 to run?

2017-10-06 Thread Stephan Houben
Op 2017-10-06, Christopher Reimer schreef : > So I got tox and tox-docker installed. When I went to install Docker > for Windows, it wouldn't work because Hyper-V wasn't available on > Windows 10 Home. After paying Microsoft $99 for the privilege, I got > Windows 10

Re: Multithreaded compression/decompression library with python bindings?

2017-10-05 Thread Stephan Houben
Op 2017-10-05, Thomas Nyberg schreef : > Btw if anyone knows a better way to handle this sort of thing, I'm all > ears. Given my current implementation I could use any compression that > works with stdin/stdout as long as I could sort out the waiting on the > subprocess. In

Re: Run Windows commands from Python console

2017-09-08 Thread Stephan Houben
Op 2017-09-06, Rick Johnson schreef : > One of the nice (current) features of Tkinter menus (that i > sometimes miss on my windows box!) is the ability to "tear- > off" a menu cascade and use it as a sort of "pseudo tool > bar". I was under the impression that Tk

asyncio.gather cancellation behaviour

2017-09-08 Thread Stephan Houben
Hi all, I am a bit mystified about the rationale of the cancellation behaviour of asyncio.gather. Case 1: "If the outer Future is cancelled, all children (that have not completed yet) are also cancelled." Case 2: "If any child is cancelled, this is treated as if it raised

Re: Best way to insert sorted in a list

2017-09-08 Thread Stephan Houben
Op 2017-09-08, logonve...@gmail.com schreef : > On Saturday, June 18, 2011 at 2:23:10 AM UTC+5:30, SherjilOzair wrote: >> There are basically two ways to go about this. >> One is, to append the new value, and then sort the list. >> Another is to traverse the list, and insert

Re: Run Windows commands from Python console

2017-09-11 Thread Stephan Houben
Op 2017-09-10, Rick Johnson schreef : > It seems to me the best solution is for the TCL/Tk folks to > provide a configuration utility that stores user preferences > in the registry, or some other OS provided mechanism, as to > have these settings reset on every

Re: array.array()'s memory shared with multiprocessing.Process()

2017-09-12 Thread Stephan Houben
Op 2017-09-12, gerlando.fala...@gmail.com schreef : > Notice however how I'd have to create those Arrays dynamically in the > producer thread. Would I then be able to pass them to the consumer by > putting a reference in a queue? Yes. > I wouldn't want them to be

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-10 Thread Stephan Houben
Op 2017-09-10, Chris Angelico schreef : > Want to make something iterable? Define __iter__. Want to make it > async-iterable (with "async for")? Define __aiter__. It's a bit clunky > if you want the same object to be iterable both ways, but I don't know > of any real-world

Re: People choosing Python 3

2017-09-10 Thread Stephan Houben
Op 2017-09-10, Marko Rauhamaa schreef : > As an application developer, I can't make the customers depend on EPEL. > It's Python2 until the distro comes with Python3. Why not bundle the Python interpreter with your application? It seems to work for Windows developers... Stephan

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-12 Thread Stephan Houben
Op 2017-09-12, Tim Golden schreef : > I agree. Except for the unusual case where someone's mistakenly chosen > to use, eg, Python 2.4 because they're using an old text book which > mentions it as the current version, most people are using the version > which suits them

[issue31427] Proposed addition to Windows FAQ

2017-09-12 Thread Stephan Houben
New submission from Stephan Houben: Several people have asked on python-list why they are running into these errors. Python 3.6.0 can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing. The solution is to install KB 2999226 "Update for Universal C Runtime in Windows&quo

Re: Fw: Problems Installing Python36

2017-09-12 Thread Stephan Houben
Op 2017-09-12, Thomas Jollans schreef : > This isn't the first time I've someone with this issue here. It's > probably putting off plenty of potential new users who don't make as > much effort to find a solution. I can't say I understand the ins and > outs of installing things on

Re: Calling methods without objects?

2017-09-26 Thread Stephan Houben
Op 2017-09-25, Stefan Ram schreef : > So, is there some mechanism in Python that can bind a method > to an object so that the caller does not have to specify the > object in the call? > > If so, how is this mechanism called? > Others have already explained the

Re: Parentheses (as after "print")

2017-09-26 Thread Stephan Houben
Op 2017-09-26, Stefan Ram schreef : > What happened? I woke up today in parens mood. So I typed: > > import( operator ) > > Python told me that I should type: > > import operator > > . Fine, Python conditioned me to omit the parens. > So now I was in noparens

Re: merits of Lisp vs Python

2017-09-30 Thread Stephan Houben
Op 2017-09-27, Robert L. schreef : > (sequence-fold + 0 #(2 3 4)) > ===> > 9 > > In Python? >>> sum([2, 3, 4]) 9 -- https://mail.python.org/mailman/listinfo/python-list

Re: LOOP with fixed final index value

2017-09-30 Thread Stephan Houben
Op 2017-09-27, Robert L. schreef : >> > (defun myloop (initial final increment) >> > (loop for i = initial then (+ i increment) >> > while (< i final) >> > do (print i) >> > finally (let ((i final)) (print i >> > > In Python? myloop =

Re: merits of Lisp vs Python

2017-09-30 Thread Stephan Houben
Op 2017-09-30, Marko Rauhamaa schreef : > Robert L. is only trolling. He uses fake technical comments to spread > white supremacy in his signatures. My apologies. Stephan -- https://mail.python.org/mailman/listinfo/python-list

Re: newb question about @property

2017-10-01 Thread Stephan Houben
Op 2017-10-01, Bill schreef : > Steve D'Aprano wrote: >> >> [1] Technically, the interpreter knows nothing about properties. What >> it cares about is *descriptors*. Properties are just one kind of >> descriptor, as are methods. But I'm intentionally not talking about >>

Re: newb question about @property

2017-10-01 Thread Stephan Houben
Op 2017-10-01, Bill schreef : > I watched an example on YouTube where someone wrote a simple descriptor > ("@Time_it) to output the amount of time that it took ordinary functions > to complete.To be honest, I AM interested in descriptors. Are you sure you are not

Re: Proposed new syntax

2017-08-23 Thread Stephan Houben
Op 2017-08-23, Ben Finney schreef : > Could you be convinced to instead do:: > > import functools > import itertools > > generate_id = functools.partial(next, itertools.count()) I certainly could be, but I was so far unaware of the desirability to do so.

Re: Proposed new syntax

2017-08-22 Thread Stephan Houben
Op 2017-08-11, Paul Rubin schreef : > I don't think we need this since we have itertools.takewhile: > > from operator import gt > from functools import partial > from itertools import takewhile > > [x + 1 for x in takewhile(partial(gt,5), (0,1,2,999,3,4))] > No

Re: Cross-language comparison: function map and similar

2017-08-20 Thread Stephan Houben
Op 2017-08-16, Steve D'Aprano schreef : > Are there language implementations which evaluate the result of map() > (or its equivalent) in some order other than the obvious left-to-right > first-to-last sequential order? Is that order guaranteed by the > language, or is

Re: Case-insensitive string equality

2017-09-03 Thread Stephan Houben
Op 2017-09-02, Pavol Lisy schreef : > But problem is that if somebody like to have stable API it has to be > changed to "do what the Unicode consortium said (at X.Y. )" :/ It is even more exciting. Presumably a reason to have case-insentivity is to be compatible with

Re: tkinter keypress events are a mess for numpad keys

2017-09-03 Thread Stephan Houben
Op 2017-08-29, Irmen de Jong schreef : > I'll have a look at https://www.tcl.tk/man/tcl8.6/TkCmd/keysyms.htm > but I don't have high hopes because I already tried empirically to > figure out the distinguishing attributes of the keypress event object, > on various platforms

Re: A question on modification of a list via a function invocation

2017-09-03 Thread Stephan Houben
Op 2017-08-17, Rustom Mody schreef : > On Thursday, August 17, 2017 at 6:49:19 AM UTC+5:30, Mok-Kong Shen wrote: >> Am 17.08.2017 um 02:41 schrieb Steve D'Aprano: >> > By reference and by value are not the only two conventions. >> > >> > Perhaps if you go back to the 1950s

Re: Installing tkinter on FreeBSD

2017-10-24 Thread Stephan Houben
Op 2017-10-23, Thomas Jollans schreef : > On 24/10/17 00:16, Dick Holmes wrote: >> I am trying to use tkinter on a FreeBSD system but the installed >> versions of Python (2.7 and 3.6) don't have thinter configured. I tried >> to download the source (no binaries available for

Re: Windows alternative: multiprocessing.connection.wait on Pipe, Tkinter File Handlers

2017-10-26 Thread Stephan Houben
Op 2017-10-23, Thomas Jollans schreef : > You might wait in a thread > and somehow (no idea what the best way to do this is in tkinter) pass a > message to the GUI thread when it's done. AFAIK, this is a real problem in Tkinter on Windows. On Posix you can use the self-pipe trick.

Re: Using Python on a fork-less POSIX-like OS

2018-07-31 Thread Stephan Houben
Op 2018-07-29, Terry Reedy schreef : > multiprocessing module uses 'spawn' rather than 'fork' on Windows and it > has an option to use 'spawn' even on *nix. I presume the latter refers > to posix_spawn. You might want to check the multiprocessing code to see > what *it* is doing 'under the

Re: Checking whether type is None

2018-07-26 Thread Stephan Houben
Op 2018-07-25, Ian Kelly schreef : > Is there a reason for using singledispatch here rather than a simpler and > more readable "if color is None" check? Yes, the other 20 cases I didn't show. And extensibility. Stephan -- https://mail.python.org/mailman/listinfo/python-list

Re: doubling the number of tests, but not taking twice as long

2018-07-16 Thread Stephan Houben
Op 2018-07-16, Larry Martell schreef : > I had some code that did this: > > meas_regex = '_M\d+_' > meas_re = re.compile(meas_regex) > > if meas_re.search(filename): > stuff1() > else: > stuff2() > > I then had to change it to this: > > if meas_re.search(filename): > if 'MeasDisplay'

Re: Can pip install packages for all users (on a Linux system)?

2018-07-25 Thread Stephan Houben
Op 2018-07-24, John Ladasky schreef : > I believe that I now have tensorflow 1.8 installed twice on my system, > once for each user. If anyone can share how to convince pip to behave > like Synaptic, I would appreciate it. Thanks. I would recommend against using pip to install packages into the

Re: Checking whether type is None

2018-07-25 Thread Stephan Houben
Op 2018-07-24, Chris Angelico schreef : > On Wed, Jul 25, 2018 at 9:18 AM, Rob Gaddi > wrote: >> On 07/24/2018 01:07 PM, Chris Angelico wrote: >> I suppose one valid usage would be this sort of thing: >> >> fn = { >> int: dispatchInt, >> str: dispatchStr, >> list: dispatchList, >>