Re: System printer object

2019-01-07 Thread Terry Reedy
On 1/7/2019 5:17 PM, Dave wrote: I need to print to one or both of my system printers.  I have not found a printer object in Python or in Tkinter.  This needs to work with Linux, Window, and Mac.  Can someone point me in the right direction? Ultimately, I want to have a File/Print in the menu t

Re: the python name

2019-01-07 Thread rbowman
On 01/07/2019 02:10 PM, DL Neil wrote: Why is that obscure? It makes perfect sense - to those of us who have used tape/serial storage! Perhaps less-so to [bobble-heads], sorry I mean people who grew-up with 'bubble memory' (Memory sticks, 'flash drives', SSDs). In point-of-fact, Python Context Ma

Re: Normalizing path strings and separators in cross-platform unit test scripts

2019-01-07 Thread eryk sun
On 1/7/19, Chris Angelico wrote: > On Tue, Jan 8, 2019 at 5:52 AM Malcolm Greene wrote: >> >> Is there a best practice way to convert Windows style paths (with >> backslash path separators) to Linux style paths with forward slash path >> separators? I've looked at the os and pathlib libraries wit

SCons Version 3.0.3 Released

2019-01-07 Thread Bill Deegan
A new SCons release, 3.0.3, is now available on the SCons download page: https://scons.org/pages/download.html Here is a summary of the changes since 3.0.1: NEW FUNCTIONALITY - Properly support versioned shared libraries for MacOS. We've also introduced two new env v

Re: Are all items in list the same?

2019-01-07 Thread Chris Angelico
On Tue, Jan 8, 2019 at 1:03 PM Skip Montanaro wrote: > > > > > > if len(a) == 0 or all(i == a[0] for i in a[1:]): > > > > > You don't need to check the length of the list because if the list is > > empty, 'all' will return True anyway. > > > > Given the structure of the expression passed as a

Re: Are all items in list the same?

2019-01-07 Thread Skip Montanaro
> > > if len(a) == 0 or all(i == a[0] for i in a[1:]): > > > You don't need to check the length of the list because if the list is > empty, 'all' will return True anyway. > Given the structure of the expression passed as an argument to all(), won't you get an IndexError if a is empty without

Re: Are all items in list the same?

2019-01-07 Thread MRAB
On 2019-01-08 00:47, i...@koeln.ccc.de wrote: You might do something like if len(a) == 0 or all(i == a[0] for i in a[1:]): You don't need to check the length of the list because if the list is empty, 'all' will return True anyway. This should be linear complexity and short circuiting a

Re: Are all items in list the same?

2019-01-07 Thread Chris Angelico
On Tue, Jan 8, 2019 at 12:26 PM Tim Chase wrote: > def all_equal(iterable): > i = iter(iterable) > first = next(i) > return all(x == first for x in i) > > And I even like how nicely it reads :-) Yes, there's something beautiful about writing "first = next" :-) ChrisA -- https://ma

Re: Are all items in list the same?

2019-01-07 Thread Tim Chase
On 2019-01-07 17:14, Bob van der Poel wrote: > I need to see if all the items in my list are the same. I was using > set() for this, but that doesn't work if items are themselves > lists. So, assuming that a is a list of some things, the best I've > been able to come up with it: > > if a.count

Re: Are all items in list the same?

2019-01-07 Thread Cameron Simpson
On 07Jan2019 17:14, bvdp wrote: I need to see if all the items in my list are the same. I was using set() for this, but that doesn't work if items are themselves lists. So, assuming that a is a list of some things, the best I've been able to come up with it: if a.count( targ ) == len(a): I'

Re: Are all items in list the same?

2019-01-07 Thread ike
You might do something like if len(a) == 0 or all(i == a[0] for i in a[1:]): This should be linear complexity and short circuiting and in general it doesn't get much better than this. Though I wouldn't bet there isn't a better (faster/clearer/more readable) solution. On Mon, Jan 07, 2019 at

Re: Are all items in list the same?

2019-01-07 Thread MRAB
On 2019-01-08 00:14, Bob van der Poel wrote: I need to see if all the items in my list are the same. I was using set() for this, but that doesn't work if items are themselves lists. So, assuming that a is a list of some things, the best I've been able to come up with it: if a.count( targ )

Are all items in list the same?

2019-01-07 Thread Bob van der Poel
I need to see if all the items in my list are the same. I was using set() for this, but that doesn't work if items are themselves lists. So, assuming that a is a list of some things, the best I've been able to come up with it: if a.count( targ ) == len(a): I'm somewhat afraid that this won't

Re: System printer object

2019-01-07 Thread Calvin Spealman
Neither Python nor Tkinter include interface libraries to talk to hardware printers out of the box, but a number of libraries and methods exist depending on your platform. Both Wx and Qt, UI toolkits with great Python bindings, do support printers to one degree or another, although I don't know how

Re: the python name

2019-01-07 Thread MRAB
On 2019-01-07 23:04, Dennis Lee Bieber wrote: On Tue, 8 Jan 2019 10:10:13 +1300, DL Neil declaimed the following: Why is that obscure? It makes perfect sense - to those of us who have used tape/serial storage! Perhaps less-so to [bobble-heads], sorry I mean people who grew-up with 'bubble m

System printer object

2019-01-07 Thread Dave
I need to print to one or both of my system printers. I have not found a printer object in Python or in Tkinter. This needs to work with Linux, Window, and Mac. Can someone point me in the right direction? Ultimately, I want to have a File/Print in the menu that lets me select the printer an

Re: the python name

2019-01-07 Thread DL Neil
On 7/01/19 3:25 PM, rbowman wrote: On 01/04/2019 10:45 AM, Peter J. Holzer wrote: FORTRAN is older than most of us. So it influenced what we think a computer language should sound like. Sadly, not for all of us...  FORTRAN seeded later languages with terms that are obscure, like rewind().  A

Re: the python name

2019-01-07 Thread DL Neil
On 7/01/19 2:52 PM, rbowman wrote: On 01/04/2019 09:34 AM, Avi Gross wrote: Although I used FORTRAN ages ago and it still seems to be in active use, I am not clear on why the name FORMULA TRANSLATOR was chosen. I do agree it does sound more like a computer language based on both the sound and

Re: the python name

2019-01-07 Thread DL Neil
On 7/01/19 9:09 AM, Avi Gross wrote: [Can we ever change the subject line?] {REAL SUBJECT: degrees of compilation.} Peter wrote: "... Hoever, this is the Python list and one of the advantages of Python is that we don't have to compile our code. So we need a different excuse for fencing on offi

Re: Normalizing path strings and separators in cross-platform unit test scripts

2019-01-07 Thread Chris Angelico
On Tue, Jan 8, 2019 at 5:52 AM Malcolm Greene wrote: > > Any recommendations on normalizing path strings in cross platform > (Windows, Linux, macOS) for unit tests? > Our goal is to normalize path strings to use forward slash separators so > that we can consistently reference path strings in our u

Normalizing path strings and separators in cross-platform unit test scripts

2019-01-07 Thread Malcolm Greene
Any recommendations on normalizing path strings in cross platform (Windows, Linux, macOS) for unit tests? Our goal is to normalize path strings to use forward slash separators so that we can consistently reference path strings in our unit tests in a cross platform way. Example: Under Windows we hav

Re: Kivy native GUI examples

2019-01-07 Thread Dave
On 1/7/19 11:14 AM, Thomas Jollans wrote: On 07/01/2019 15.51, Dave wrote: I need to select a Python GUI.  It needs to cover all of the desktops (Linux, Windows, Apple) and hopefully mobile (Android and Ios).  I'm looking at Kivy, but have yet to find an example app. that has a native looking GU

Re: Kivy native GUI examples

2019-01-07 Thread Thomas Jollans
On 07/01/2019 15.51, Dave wrote: > I need to select a Python GUI.  It needs to cover all of the desktops > (Linux, Windows, Apple) and hopefully mobile (Android and Ios).  I'm > looking at Kivy, but have yet to find an example app. that has a native > looking GUI (Windows, Mac, Linux/Gnome/KDE).  I

Re: Kivy native GUI examples

2019-01-07 Thread Thomas Jollans
On 07/01/2019 15.51, Dave wrote: > I need to select a Python GUI.  It needs to cover all of the desktops > (Linux, Windows, Apple) and hopefully mobile (Android and Ios).  I'm > looking at Kivy, but have yet to find an example app. that has a native > looking GUI (Windows, Mac, Linux/Gnome/KDE).  I

Kivy native GUI examples

2019-01-07 Thread Dave
I need to select a Python GUI. It needs to cover all of the desktops (Linux, Windows, Apple) and hopefully mobile (Android and Ios). I'm looking at Kivy, but have yet to find an example app. that has a native looking GUI (Windows, Mac, Linux/Gnome/KDE). Is that possible and anyone know of so

ANN: Python Meeting Düsseldorf - 09.01.2019

2019-01-07 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group meeting in Düsseldorf, Germany] ANKÜNDIGUNG Python Meeting Düsseldorf http://pyddf.de/ Ein Tr

Re: Recommendations for a novice user.

2019-01-07 Thread DL Neil
Hüseyin, On 7/01/19 3:35 PM, rbowman wrote: On 01/02/2019 05:14 AM, Hüseyin Ertuğrul wrote: I don't know the software language at all. What do you recommend to beginners to learn Python. What should be the working systematic? How much time should I spend every day or how much time should I spe