Re: Python 3

2020-11-07 Thread Hernán De Angelis
Hi, Wikipedia has an article on the duodecimal system, that includes an explanation of how to convert from decimal and the other way around. https://en.wikipedia.org/wiki/Duodecimal?wprov=sfla1 Peerrhaps it can be easily implemented as a function. Good luck. H. Den lör 7 nov. 2020 07:55Nick

Re: Python 3

2020-11-07 Thread Barry Scott
> On 7 Nov 2020, at 06:51, Nick Li wrote: > > Does anyone know how to turn a decimal number into duodecimal or if there is > a function built-in for it? I see lots of interesting answer in here: https://stackoverflow.com/questions/2267362/how-to-convert-an-integer-to-a-string-in-any-base

RE: Python 3..9.0

2020-10-09 Thread Schachner, Joseph
You're not doing anything wrong, but clearly it's not what you want to do. You are running the Python interpreter and not specifying any script to run, so it opens a command prompt and promptly closes it, I'll bet. What you want to do is open a development environment. Try Idle, it's there i

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-30 Thread Chris Green
Cameron Simpson wrote: > On 29Aug2020 16:50, Chris Green wrote: > >However the problem appears to be that internally in Python 3 mailbox > >class there is an assumption that it's being given 'ascii'. Here's > >the error (and I'm doing no processing of the message at all):- > > > >Traceback (

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-30 Thread Chris Green
Karsten Hilbert wrote: > > However the problem appears to be that internally in Python 3 mailbox > > class there is an assumption that it's being given 'ascii'. > > Do you really _need_ the mailbox class ? From what you've > written so far my understanding was that you receive data > (bytes) and

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Cameron Simpson
On 29Aug2020 16:50, Chris Green wrote: >However the problem appears to be that internally in Python 3 mailbox >class there is an assumption that it's being given 'ascii'. Here's >the error (and I'm doing no processing of the message at all):- > >Traceback (most recent call last): > File

Aw: Re: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Karsten Hilbert
> Just appending a message as a raw file to a mailbox, doesn't properly > add it as a new message. You need to add a From: line to the front, and > then go through the message and alter any line that begins as "From:" > (and possibly any line that begins with something like ">From:" or > ">>From:"

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Richard Damon
On 8/29/20 3:31 PM, Karsten Hilbert wrote: >> However the problem appears to be that internally in Python 3 mailbox >> class there is an assumption that it's being given 'ascii'. > Do you really _need_ the mailbox class ? From what you've > written so far my understanding was that you receive data

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Karsten Hilbert
> However the problem appears to be that internally in Python 3 mailbox > class there is an assumption that it's being given 'ascii'. Do you really _need_ the mailbox class ? From what you've written so far my understanding was that you receive data (bytes) and want to append that to a file (which

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Richard Damon
On 8/29/20 11:50 AM, Chris Green wrote: > Chris Green wrote: >> Dennis Lee Bieber wrote: >>> On Fri, 28 Aug 2020 12:26:07 +0100, Chris Green declaimed >>> the >>> following: >>> >>> >>> Maybe I shouldn't but Python 2 has been managing to do so for several years without any issues. I

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Chris Green
Chris Green wrote: > Dennis Lee Bieber wrote: > > On Fri, 28 Aug 2020 12:26:07 +0100, Chris Green declaimed > > the > > following: > > > > > > > > >Maybe I shouldn't but Python 2 has been managing to do so for several > > >years without any issues. I know I *could* put the exceptions in a >

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Chris Green
Dennis Lee Bieber wrote: > On Fri, 28 Aug 2020 12:26:07 +0100, Chris Green declaimed the > following: > > > > >Maybe I shouldn't but Python 2 has been managing to do so for several > >years without any issues. I know I *could* put the exceptions in a > >bucket somewhere and deal with them sep

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Grant Edwards
On 2020-08-28, Chris Green wrote: > Maybe I shouldn't but Python 2 has been managing to do so for several > years without any issues. I know I *could* put the exceptions in a > bucket somewhere and deal with them separately but I'd really rather > not. Then just leave it as bytes and do whateve

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Grant Edwards
On 2020-08-27, Chris Green wrote: > bbb = [b'aaa', b'bbb', b'ccc'] > sss = [] > for i in range(0, 2): > sss.append(str(bbb[i]) > > but that does seem a bit clumsy. Is there a better way? sss = [str(s) for s in bbb] -- Grant -- https://mail.python.org/mailman/listinfo/pyth

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-29 Thread Grant Edwards
On 2020-08-27, Marco Sulla wrote: > Are you sure you want `str()`? > str(b'aaa') > "b'aaa'" > > Probably you want: > > map(lambda x: x.decode(), bbb) If you're an old Scheme or Lisp programmer. :) This is probably the more usual way to spell it: sss = [x.decode() for x in bbb] -- ht

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 12:26, Chris Green wrote: >Cameron Simpson wrote: >> POP3 is presumably handing you bytes containing a message. If the >> Python >> email.BytesParser doesn't handle it, stash the raw bytes _elsewhere_ in >> a distinct file in some directory. >> >> with open('evil_msg_bytes', 'wb

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:44 AM, Chris Green wrote: > Stefan Ram wrote: >> Chris Green writes: >>> Therein lies the problem, the incoming byte stream *isn't* ASCII, it's >>> an E-Mail message which may, for example, have UTF-8 or other encoded >>> characters in it. Hopefully it will have an encoding given in

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 11:24 PM Chris Green wrote: > > Chris Angelico wrote: > > > > Also, if you're parsing an email message, you can and should be doing > > so with respect to the encoding(s) stipulated in the headers, after > > which you will have valid Unicode text. > > > But not all E-Mail

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread D'Arcy Cain
On 2020-08-28 08:30, Richard Damon wrote: > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage. For English speaking Americans. > Python2 handled that sort of case quite easily. Python 3 on the other > hand, will have issue converting the byte mess

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico wrote: > > Also, if you're parsing an email message, you can and should be doing > so with respect to the encoding(s) stipulated in the headers, after > which you will have valid Unicode text. > But not all E-Mail messages are 'well behaved', the above works fine if the headers sp

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> I want to transport the message into my mbox and Python 3 won't do it > without knowing how it's encoded whereas Python 2 just stuffed it in > there 'as is'. > > I want Python 3's mailbox class to juyst put what I tell it (even if > mis-formatted or mis-encoded) into the mbox. I guess using the

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 8:39 AM, Chris Green wrote: > Richard Damon wrote: >> On 8/28/20 7:50 AM, Karsten Hilbert wrote: > No interpreation requires, since parsing failed. Then you can start > dealing with these exceptions. _Do not_ write unparsable messages into > an mbox! > Maybe I shoul

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:51 PM Chris Green wrote: > > > One possible solution in Python3 is to decode the byte string using an > > encoding that allows all 256 byte values, so it won't raise any encoding > > errors, just give your possibly non-sense characters for non-ASCII text. > > > But this

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram wrote: > Chris Green writes: > >Therein lies the problem, the incoming byte stream *isn't* ASCII, it's > >an E-Mail message which may, for example, have UTF-8 or other encoded > >characters in it. Hopefully it will have an encoding given in the > >header but that's only if the sender

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Richard Damon wrote: > On 8/28/20 7:50 AM, Karsten Hilbert wrote: > >>> No interpreation requires, since parsing failed. Then you can start > >>> dealing with these exceptions. _Do not_ write unparsable messages into > >>> an mbox! > >>> > >> Maybe I shouldn't but Python 2 has been managing to do

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Angelico
On Fri, Aug 28, 2020 at 10:32 PM Richard Damon wrote: > > This might be one of the cases where Python 2's lack handling of string > vs bytes was an advantage. > > If he was just scanning the message for specific ASCII strings, then not > getting the full message decoded write is unlikely to have b

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote: >>> No interpreation requires, since parsing failed. Then you can start >>> dealing with these exceptions. _Do not_ write unparsable messages into >>> an mbox! >>> >> Maybe I shouldn't but Python 2 has been managing to do so for several >> years without an

Re: Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Richard Damon
On 8/28/20 7:50 AM, Karsten Hilbert wrote: >>> No interpreation requires, since parsing failed. Then you can start >>> dealing with these exceptions. _Do not_ write unparsable messages into >>> an mbox! >>> >> Maybe I shouldn't but Python 2 has been managing to do so for several >> years without an

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> > No interpreation requires, since parsing failed. Then you can start > > dealing with these exceptions. _Do not_ write unparsable messages into > > an mbox! > > > Maybe I shouldn't but Python 2 has been managing to do so for several > years without any issues. I am inclined to congratulate you

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson wrote: > On 28Aug2020 08:56, Chris Green wrote: > >Stefan Ram wrote: > >> Chris Angelico writes: > >> >But this is a really good job for a list comprehension: > >> >sss = [str(word) for word in bbb] > >> > >> Are you all sure that "str" is really what you all want? > >> > >Not

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Cameron Simpson
On 28Aug2020 08:56, Chris Green wrote: >Stefan Ram wrote: >> Chris Angelico writes: >> >But this is a really good job for a list comprehension: >> >sss = [str(word) for word in bbb] >> >> Are you all sure that "str" is really what you all want? >> >Not absolutely, you no doubt have been follow

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Cameron Simpson wrote: > On 27Aug2020 23:54, Marco Sulla wrote: > >Are you sure you want `str()`? > > > str(b'aaa') > >"b'aaa'" > > > >Probably you want: > > > >map(lambda x: x.decode(), bbb) > > _And_ you need to know the encoding of the text in the bytes. The above > _assumes_ UTF-8 beca

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Chris Angelico wrote: > On Fri, Aug 28, 2020 at 6:36 AM Chris Green wrote: > > > > This sounds quite an easy thing to do but I can't find how to do it > > elegantly. > > > > I have a list of bytes class objects (i.e. a list containing sequences > > of bytes, which are basically text) and I want t

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Chris Green
Stefan Ram wrote: > Chris Angelico writes: > >But this is a really good job for a list comprehension: > >sss = [str(word) for word in bbb] > > Are you all sure that "str" is really what you all want? > Not absolutely, you no doubt have been following other threads related to this one. :-)

Aw: Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-28 Thread Karsten Hilbert
> >Are you sure you want `str()`? > > > str(b'aaa') > >"b'aaa'" > > > >Probably you want: > > > >map(lambda x: x.decode(), bbb) > > _And_ you need to know the encoding of the text in the bytes. The above > _assumes_ UTF-8 because that is the default for bytes.decode, and if > that is _not_ wha

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-27 Thread Cameron Simpson
On 27Aug2020 23:54, Marco Sulla wrote: >Are you sure you want `str()`? > str(b'aaa') >"b'aaa'" > >Probably you want: > >map(lambda x: x.decode(), bbb) _And_ you need to know the encoding of the text in the bytes. The above _assumes_ UTF-8 because that is the default for bytes.decode, and if

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-27 Thread Marco Sulla
Are you sure you want `str()`? >>> str(b'aaa') "b'aaa'" Probably you want: map(lambda x: x.decode(), bbb) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 how to convert a list of bytes objects to a list of strings?

2020-08-27 Thread Chris Angelico
On Fri, Aug 28, 2020 at 6:36 AM Chris Green wrote: > > This sounds quite an easy thing to do but I can't find how to do it > elegantly. > > I have a list of bytes class objects (i.e. a list containing sequences > of bytes, which are basically text) and I want to convert it to a list > of string ob

Re: python 3 prefix to infix without too many parethesis

2019-12-09 Thread DL Neil via Python-list
On 10/12/19 8:40 AM, Terry Reedy wrote: On 12/9/2019 6:21 AM, jezka...@gmail.com wrote: Hi, I have got a problem. Is this homework? Same question - that way we know that our task is to help you learn to code in Python, cf a problem with Python itself... Similarly, you may like to know th

Re: python 3 prefix to infix without too many parethesis

2019-12-09 Thread Terry Reedy
On 12/9/2019 6:21 AM, jezka...@gmail.com wrote: Hi, I have got a problem. Is this homework? I wrote a code for prefix to infix. It works, but I need improve it so on input there will be only necessary parentheses. Define 'necessary'; give multiple input/output examples. Put them in a test f

Re: Python 3 Boto Unable to parse pagination error

2019-02-27 Thread MRAB
On 2019-02-26 20:06, Tim Dunphy wrote: Hi all, I'm trying to create a python 3 script that takes a list of AWS instance IDs. It then prints out some information about the instances and then terminates them. I am very new to python, so still working through some basic issues. This is the error

Re: python 3 creating hard links on ntfs

2018-04-19 Thread zljubisic
Thanks guys. -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3 creating hard links on ntfs

2018-04-18 Thread eryk sun
On Wed, Apr 18, 2018 at 8:06 PM, wrote: > Is it possible to create hard links on windows with ntfs? > On linux I can use os.link, but how about windows? Windows support was added for os.link years ago in version 3.2. Internally it's implemented via WinAPI CreateHardLink, which in turn calls NTAP

Re: python 3 creating hard links on ntfs

2018-04-18 Thread Steven D'Aprano
On Wed, 18 Apr 2018 13:06:37 -0700, zljubisic wrote: > Is it possible to create hard links on windows with ntfs? On linux I can > use os.link, but how about windows? According to the documentation, creating hard links on Windows has worked since version 3.2: https://docs.python.org/3/library/os

Re: OT was Re: Python 3 removes name binding from outer scope

2017-07-26 Thread Paul Rubin
Chris Angelico writes: >>> Bipartisan-US-Bill-Moves-to-Criminalize-BDS-Support-20170720-0001.html >> Heh, at first I read that as a bill to criminalise BSD support :-) > I spluttered my drink on reading that. Good job Steven! https://en.wikipedia.org/wiki/BDS_C -- https://mail.python.org/mailman

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Steve D'Aprano
On Wed, 26 Jul 2017 06:06 am, Chris Angelico wrote: > Hmm. Aside from messing around with exec, is there any way to have a > local and a global with the same name, and use the global? Use globals['name']. There's no way to do it with regular name look ups. This doesn't work: spam = 'outside'

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Chris Angelico
On Wed, Jul 26, 2017 at 4:36 AM, eryk sun wrote: > On Tue, Jul 25, 2017 at 8:43 AM, Chris Angelico wrote: >> >> I'm not actually sure what happens if you use a global declaration at >> top level. Is it ignored? Is it an error? > > It isn't ignored, but it shouldn't make a difference since normall

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Ian Kelly
On Tue, Jul 25, 2017 at 5:38 AM, Thomas Jollans wrote: > On 2017-07-25 09:28, Chris Angelico wrote: >> It actually does the equivalent of: >> >> finally: >> e = None > > I wonder why it would bother to load None... (as someone not very > familiar with Python at the bytecode level) If I may ha

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread eryk sun
On Tue, Jul 25, 2017 at 8:43 AM, Chris Angelico wrote: > > I'm not actually sure what happens if you use a global declaration at > top level. Is it ignored? Is it an error? It isn't ignored, but it shouldn't make a difference since normally at module level locals and globals are the same. It make

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Thomas Jollans
On 2017-07-25 09:28, Chris Angelico wrote: > On Tue, Jul 25, 2017 at 4:47 PM, Rustom Mody wrote: >> +1 >> You can call it bug or bug-promoted-to-feature :D >> >> I call it surprising because I dont know of any other case in python where >> a delete is user-detectable >> ie python's delete of objec

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Chris Angelico
On Tue, Jul 25, 2017 at 6:10 PM, Ben Finney wrote: > I think those are not the only two options (the “except clause has its > own scope” behaviour is an option that could have been chosen, for > example). > > At this point the behaviour and motivation are clear, having been > revealed; I disagree

Re: OT was Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Chris Angelico
On Tue, Jul 25, 2017 at 6:33 PM, Steven D'Aprano wrote: > On Mon, 24 Jul 2017 23:47:17 -0700, Rustom Mody wrote: > > > [...] >> Bipartisan-US-Bill-Moves-to-Criminalize-BDS-Support-20170720-0001.html > > > Heh, at first I read that as a bill to criminalise BSD support :-) > I spluttered my drink o

OT was Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Steven D'Aprano
On Mon, 24 Jul 2017 23:47:17 -0700, Rustom Mody wrote: [...] > Bipartisan-US-Bill-Moves-to-Criminalize-BDS-Support-20170720-0001.html Heh, at first I read that as a bill to criminalise BSD support :-) -- “You are deluded if you think software engineers who can't write operating systems or

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Ben Finney
Steven D'Aprano writes: > On Tue, 25 Jul 2017 17:02:48 +1000, Ben Finney wrote: > > > I suppose my objection is rooted in the fact this behaviour is > > implicit; my code has not issued a ‘del’ statement, and so I don't > > expect one; yet it occurs implicitly. This violates the Zen of > > Python

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Steven D'Aprano
On Tue, 25 Jul 2017 17:02:48 +1000, Ben Finney wrote: > Ben Finney writes: > >> Having to make another name for the same object, merely to avoid some >> surprising behaviour, is IMO un-Pythonic. > > I suppose my objection is rooted in the fact this behaviour is implicit; > my code has not issue

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Steven D'Aprano
On Tue, 25 Jul 2017 00:01:11 -0700, Ethan Furman wrote: > On 07/24/2017 11:47 PM, Rustom Mody wrote: > >> Interesting to see this adjacent to news that non-participation is >> about to be criminalized double of [snip] > > Rustom, All, > > This is a Python mailing list. Please keep the topics m

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Chris Angelico
On Tue, Jul 25, 2017 at 4:47 PM, Rustom Mody wrote: > +1 > You can call it bug or bug-promoted-to-feature :D > > I call it surprising because I dont know of any other case in python where > a delete is user-detectable > ie python's delete of objects always works quietly behind the scenes whereas >

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Steven D'Aprano
On Mon, 24 Jul 2017 21:48:56 -0700, Rustom Mody wrote: > On Tuesday, July 25, 2017 at 7:12:44 AM UTC+5:30, Ben Finney quoted > Thomas Jefferson's : > >> The cost of education is trivial compared to the cost of ignorance. > > > An interesting standard of “trivial”… given… You're reading the qu

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Ben Finney
Ben Finney writes: > Having to make another name for the same object, merely to avoid some > surprising behaviour, is IMO un-Pythonic. I suppose my objection is rooted in the fact this behaviour is implicit; my code has not issued a ‘del’ statement, and so I don't expect one; yet it occurs impli

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Stefan Behnel
Ben Finney schrieb am 25.07.2017 um 08:34: > Ethan Furman writes: > >> Something like: >> >> try: >> >> except ZeroDivisionError as dead_exc: >> exc = dead_exc >> >> >> print(text_template.format(exc=exc) > > That strikes me as busy-work; the

Re: Python 3 removes name binding from outer scope

2017-07-25 Thread Ethan Furman
On 07/24/2017 11:47 PM, Rustom Mody wrote: Interesting to see this adjacent to news that non-participation is about to be criminalized double of [snip] Rustom, All, This is a Python mailing list. Please keep the topics marginally on-topic. Thanks. -- ~Ethan~ -- https://mail.python.org/ma

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Rustom Mody
On Tuesday, July 25, 2017 at 12:04:45 PM UTC+5:30, Ben Finney wrote: > Ethan Furman writes: > > > Something like: > > > > try: > > > > except ZeroDivisionError as dead_exc: > > exc = dead_exc > > > > > > print(text_template.format(exc=exc) >

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Ben Finney
Ethan Furman writes: > Something like: > > try: > > except ZeroDivisionError as dead_exc: > exc = dead_exc > > > print(text_template.format(exc=exc) That strikes me as busy-work; the name in the ‘except’ clause already *has* the object, and

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Paul Rubin
Ben Finney writes: > How can I stop Python from deleting a name binding, when that name is > used for binding the exception that is caught? Use sys.exc_info() -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Rustom Mody
On Tuesday, July 25, 2017 at 7:12:44 AM UTC+5:30, Ben Finney quoted Thomas Jefferson's : > The cost of education is trivial compared to the cost of ignorance. An interesting standard of “trivial”… given… UK has risen to more than £100 billion for the first time https://www.theguardian.com/mon

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Steve D'Aprano
On Tue, 25 Jul 2017 11:41 am, Ben Finney wrote: > Howdy all, > > How can I stop Python from deleting a name binding, when that name is > used for binding the exception that is caught? When did this change in > behaviour come into Python? > > > I am writing code to run on both Python 2 and Pytho

Re: Python 3 removes name binding from outer scope

2017-07-24 Thread Ethan Furman
On 07/24/2017 06:41 PM, Ben Finney wrote: How can I stop Python from deleting a name binding, when that name is used for binding the exception that is caught? When did this change in behaviour come into Python? I am writing code to run on both Python 2 and Python 3:: exc = None try:

Re: python 3 dict: .keys(), .values(), and .item()

2017-01-07 Thread Steve D'Aprano
On Sun, 8 Jan 2017 08:48 am, Ethan Furman wrote: > In Python 2 we have: > >dict().keys() \ >dict().items() --> separate list() of the results >dict().values() / > > and > >dict().iter_keys() \ >dict().iter_items() --> integrated iter() of the results >dict().it

Re: python 3 dict: .keys(), .values(), and .item()

2017-01-07 Thread Ethan Furman
On 01/07/2017 03:04 PM, Peter Otten wrote: Ethan Furman wrote: In Python 2 we have: dict().keys() \ dict().items() --> separate list() of the results dict().values() / and dict().iter_keys() \ dict().iter_items() --> integrated iter() of the results dict().i

Re: python 3 dict: .keys(), .values(), and .item()

2017-01-07 Thread Peter Otten
Ethan Furman wrote: > In Python 2 we have: > >dict().keys() \ >dict().items() --> separate list() of the results >dict().values() / > > and > >dict().iter_keys() \ >dict().iter_items() --> integrated iter() of the results >dict().iter_values() / I guess you di

Re: Python 3 curiosity.

2016-09-06 Thread Wildman via Python-list
On Wed, 07 Sep 2016 02:27:40 +1000, Chris Angelico wrote: > On Wed, Sep 7, 2016 at 2:13 AM, Wildman via Python-list > wrote: >> On Tue, 06 Sep 2016 02:51:39 -0700, wxjmfauth wrote: >> >>> It's curious to see all these apps, that were >>> more of less working correctly up to Python 3.2 >>> (includ

Re: Python 3 curiosity.

2016-09-06 Thread Chris Angelico
On Wed, Sep 7, 2016 at 2:13 AM, Wildman via Python-list wrote: > On Tue, 06 Sep 2016 02:51:39 -0700, wxjmfauth wrote: > >> It's curious to see all these apps, that were >> more of less working correctly up to Python 3.2 >> (included) and are now no more working at all. >> >> Probably something wro

Re: Python 3 curiosity.

2016-09-06 Thread Wildman via Python-list
On Tue, 06 Sep 2016 02:51:39 -0700, wxjmfauth wrote: > It's curious to see all these apps, that were > more of less working correctly up to Python 3.2 > (included) and are now no more working at all. > > Probably something wrong somewhere... http://sebastianraschka.com/Articles/2014_python_2_3_k

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

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

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

2016-08-26 Thread d...@forestfield.co.uk
Thanks for the replies. My example seems to be from the fairly harmless end of a wedge of behaviours that are being handled much more sensibly in Python 3. -- https://mail.python.org/mailman/listinfo/python-list

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

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

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

2016-08-26 Thread Chris Angelico
On Fri, Aug 26, 2016 at 6:50 PM, d...@forestfield.co.uk wrote: > In a program I'm converting to Python 3 I'm examining a list of divisor > values, some of which can be None, to find the first with a value greater > than 1. > > Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Int

Re: Python 3: Launch multiple commands(subprocesses) in parallel (but upto 4 any time at same time) AND store each of their outputs into a variable

2016-08-24 Thread Rob Gaddi
lax.cla...@gmail.com wrote: > Hi, > > I've been reading various forums and python documentation on subprocess, > multithreading, PIPEs, etc. But I cannot seem to mash together several of my > requirements into working code. > > I am trying to: > > 1) Use Python 3+ (specifically 3.4 if it matter

Re: Python 3 tkinter graphical statistical distributions fitter

2016-08-24 Thread Daniel Riaño
Please accept my apologies for sending the message to the full list 😬 2016-08-24 13:11 GMT+02:00 Daniel Riaño : > Thanks, James! > > 2016-08-13 12:46 GMT+02:00 : > >> I created a Python 3 tkinter graphical statistical distributions fitting >> application that will fit a 1D data set to all of the

Re: Python 3 tkinter graphical statistical distributions fitter

2016-08-24 Thread Daniel Riaño
Thanks, James! 2016-08-13 12:46 GMT+02:00 : > I created a Python 3 tkinter graphical statistical distributions fitting > application that will fit a 1D data set to all of the continuous > statistical distributions in scipy.stats, with graphical display of the > distributions plotted against norma

Re: Python 3: Launch multiple commands(subprocesses) in parallel (but upto 4 any time at same time) AND store each of their outputs into a variable

2016-08-23 Thread Paul Rubin
Dale Marvin writes: > The best way is a matter of opinion, I have had success using Celery > with Redis. I generally use GNU Parallel for stuff like that. Celery looks interesting though much fancier. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3: Launch multiple commands(subprocesses) in parallel (but upto 4 any time at same time) AND store each of their outputs into a variable

2016-08-23 Thread Dale Marvin via Python-list
On 8/23/16 8:15 PM, lax.cla...@gmail.com wrote: > I am trying to: > > 1) Use Python 3+ (specifically 3.4 if it matters) > 2) Launch N commands in background (e.g., like subprocess.call would for individual commands) > 3) But only limit P commands to run at same time > 4) Wait until all N comman

Re: Python 3 virtualenvs

2015-11-30 Thread Laura Creighton
In a message of Mon, 30 Nov 2015 10:28:46 -0700, Carl Meyer writes: >So I agree that for now you should be sticking with virtualenv (I use it >too), but I hope you'll take another look at venv a few years down the >road, if you find yourself in a situation where all the interpreters you >need are

Re: Python 3 virtualenvs

2015-11-30 Thread Jon Ribbens
On 2015-11-30, Carl Meyer wrote: > (Or maybe virtualenv will make the transition sooner, and you'll start > using venv under the hood for 3.3+ without even realizing it.) It does sound like that would be the ideal solution, and presumably can't be very hard if venv is supposed to do exactly what

Re: Python 3 virtualenvs

2015-11-30 Thread Carl Meyer
On 11/30/2015 10:20 AM, Laura Creighton wrote: > In a message of Mon, 30 Nov 2015 09:32:27 -0700, Carl Meyer writes: >>> I think it is only meant to be used by people who want to install >>> packages but not site-wide, but I am not sure about that. >> >> I don't know what you mean by this either. I

Re: Python 3 virtualenvs

2015-11-30 Thread Laura Creighton
In a message of Mon, 30 Nov 2015 09:32:27 -0700, Carl Meyer writes: >Hi Laura, >I don't know what you mean by this. Venv is intended to do _exactly_ >what virtualenv does, only better. Unless by "what virtualenv does" you >mean "also support Python 2." That is exactly what I mean. >> I think it

Re: Python 3 virtualenvs

2015-11-30 Thread Carl Meyer
Hi Laura, On 11/29/2015 07:12 AM, Laura Creighton wrote: > pyenv is going away. python -m venv is the preferred way to get a venv > > https://bugs.python.org/issue25154 > > Of course if you try it, you may get: > > Error: Command '['/bin/python3.4', '-Im', 'ensurepip', > '--upgrade', '--def

Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:23:19 +, Jon Ribbens writes: >I don't know if, in future, pyvenv will be the way to go and >virtualenv will be deprecated, but either way we do not appear >to be there yet. pyenv is going away. python -m venv is the preferred way to get a venv https://bugs

Re: Python 3 virtualenvs

2015-11-29 Thread Jon Ribbens
On 2015-11-29, Laura Creighton wrote: > In a message of Sun, 29 Nov 2015 13:19:46 +0100, Lele Gaifax writes: >>Jon Ribbens writes: > No, Pyvenv is precisely what Daniele can not use. > The problem is that venv does not come with a big sign saying > > ONLY FOR PYTHON 3.x > ABSOLUTELY DOES NOT WORK

Re: Python 3 virtualenvs

2015-11-29 Thread Laura Creighton
In a message of Sun, 29 Nov 2015 13:19:46 +0100, Lele Gaifax writes: >Jon Ribbens writes: > >> On 2015-11-28, D.M. Procida >> wrote: >>> >>> Is something else required? >> >> Debian's package management is mysterious and apparently bizarre >> and frankly in respect to Python, not very good. > >I

Re: Python 3 virtualenvs

2015-11-29 Thread Lele Gaifax
Jon Ribbens writes: > On 2015-11-28, D.M. Procida > wrote: >> >> Is something else required? > > Debian's package management is mysterious and apparently bizarre > and frankly in respect to Python, not very good. I do not agree with you on the quality of Python support on Debian systems, but I

Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida wrote: > Jon Ribbens wrote: > >> On 2015-11-28, D.M. Procida > wrote: >> > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 >> > installed. >> > >> > I want to use Python 3.4 by default for most things, so I want >> > virtualenv to create Python 3.

Re: Python 3 virtualenvs

2015-11-28 Thread D.M. Procida
Jon Ribbens wrote: > On 2015-11-28, D.M. Procida wrote: > > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 > > installed. > > > > I want to use Python 3.4 by default for most things, so I want > > virtualenv to create Python 3.4 virtualenvs unless I ask it to > > otherwise.

Re: Python 3 virtualenvs

2015-11-28 Thread Jon Ribbens
On 2015-11-28, D.M. Procida wrote: > I have a new installation of Debian Jessie, with Python 2.7 and 3.4 > installed. > > I want to use Python 3.4 by default for most things, so I want > virtualenv to create Python 3.4 virtualenvs unless I ask it to > otherwise. > > It turns out that this seems t

Re: Python 3 virtualenvs

2015-11-27 Thread D.M. Procida
Laura Creighton wrote: > In a message of Sat, 28 Nov 2015 00:37:21 +, D.M. Procida writes: > >I have a new installation of Debian Jessie, with Python 2.7 and 3.4 > >installed. > > > >I want to use Python 3.4 by default for most things, so I want > >virtualenv to create Python 3.4 virtualenvs

Re: Python 3 virtualenvs

2015-11-27 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 00:37:21 +, D.M. Procida writes: >I have a new installation of Debian Jessie, with Python 2.7 and 3.4 >installed. > >I want to use Python 3.4 by default for most things, so I want >virtualenv to create Python 3.4 virtualenvs unless I ask it to >otherwise. > >It

Re: Python 3 sort() problem

2015-08-17 Thread Rustom Mody
On Monday, August 17, 2015 at 7:32:08 PM UTC+5:30, Владислав wrote: > # first: works fine > x = [1, 2, 4, 2, 1, 3] > x = list(set(x)) > x.sort() > print(x)  # output: 1, 2, 3, 4 > > # second: why x became None ?? > x = [1, 2, 4, 2, 1, 3] > x = list(set(x)).sort() > print(x)  # output: None > I kno

Re: Python 3 sort() problem

2015-08-17 Thread Mark Lawrence
On 17/08/2015 12:42, Владислав wrote: # first: works fine x = [1, 2, 4, 2, 1, 3] x = list(set(x)) x.sort() print(x) /# output: 1, 2, 3, 4 /# second: why x became None ?? x = [1, 2, 4, 2, 1, 3] x = list(set(x)).sort() print(x) /# output: None/ I know that sort() returns None, but I guess that

Re: Python 3 sort() problem

2015-08-17 Thread Fabien
On 08/17/2015 01:42 PM, Владислав wrote: x = [1, 2, 4, 2, 1, 3] x = list(set(x)).sort() print(x) /# output: None/ I know that sort() returns None, but I guess that it would be returned x that was sorted. Why so? If sort() returns None, than the following: x = list(set(x)).sort() is equivalen

Re: Python 3 sort() problem

2015-08-17 Thread Joonas Liik
> > I know that sort() returns None, but I guess that it would be returned x > that was sorted. Why so? if it returned a sorted list it might lead some people to believe it did not modify the oridinal list which would lead to a ton of confusion for new users. -- https://mail.python.org/mailman/li

  1   2   3   4   5   6   7   8   9   10   >