Re: f-string

2017-12-08 Thread Chris Angelico
On Tue, Dec 5, 2017 at 6:37 PM, Ned Batchelder wrote: > On 12/5/17 7:16 PM, Steve D'Aprano wrote: >> compile('f"{spam} {eggs}"', '', 'single') > > $ python3.6 > Python 3.6.3 (default, Octâ 4 2017, 06:03:25) > [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin > Typ

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread breamoreboy
On Monday, December 4, 2017 at 7:10:01 PM UTC, Jason Maldonis wrote: > I was extending a `list` and am wondering why slicing lists will never > raise an IndexError, even if the `slice.stop` value if greater than the > list length. > > Quick example: > > my_list = [1, 2, 3] > my_list[:100] # does n

How to use a regexp here

2017-12-08 Thread Cecil Westerhof
I have a script that was running perfectly for some time. It uses: array = [elem for elem in output if 'CPU_TEMP' in elem] But because output has changed, I have to check for CPU_TEMP at the beginning of the line. What would be the best way to implement this? -- Cecil Westerhof Senior Softwar

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Rick Johnson writes: >> There is now also a line that starts with: PCH_CPU_TEMP: >> And I do not want that one. > > Yes. But be aware, that while the `str.startswith(target)` > method is indeed more efficient than a more generalized > "inclusion test", if the target is not _always_ at the > begin

repeating posts

2017-12-08 Thread Rustom Mody
Repeating old posts again appearing [No not complaining… I know people are working on it. Thanks Skip and whoever else] Just thought I'd mention they are now mildly mojibaked -- https://mail.python.org/mailman/listinfo/python-list

Save and load initialized class

2017-12-08 Thread Bob van der Poel
I'm trying to something simple (yeah, right). Mainly I want to have a bunch of variables which my program needs and uses to be in a saveable/loadable block. Currently I have then all as a bunch of globals which works, but trying to keep track of them and the correct spellings, etc becomes a bit of

Re: How to use a regexp here

2017-12-08 Thread breamoreboy
On Monday, December 4, 2017 at 9:44:27 AM UTC, Cecil Westerhof wrote: > I have a script that was running perfectly for some time. It uses: > array = [elem for elem in output if 'CPU_TEMP' in elem] > > But because output has changed, I have to check for CPU_TEMP at the > beginning of the line. W

Re: f-string

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 11:54 am, John Pote wrote: [...] > Ran above test file and got, > >>python36 compiletest.py > at 0x02120E40, file "", line 1> > > > SPAM scrambled Thanks everyone, that's what I wanted to see. -- Steve â £Cheer up,â Ø they said, â £things could be worse.â Ø So I ch

Re: we want python software

2017-12-08 Thread Percival John Hackworth
On 05-Dec-2017, km wrote (in article): > I dont know how these students are selected into b tech stream in India. > they are so dumb. All they know is a to open a program we need to double > click it and it runs.- windoze legacy. most of the time they pay huge > amount to a greedy college and get

Re: f-string

2017-12-08 Thread Chris Angelico
On Wed, Dec 6, 2017 at 8:24 PM, Steve D'Aprano wrote: > On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote: > >> On Wed, Dec 6, 2017 at 11:54 AM, John Pote >> wrote: >>> >>> On 06/12/2017 00:16, Steve D'Aprano wrote: Anyone got a handy copy of Python 3.6 available to test something for m

Re: f-string

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote: > On Wed, Dec 6, 2017 at 11:54 AM, John Pote > wrote: >> >> On 06/12/2017 00:16, Steve D'Aprano wrote: >>> >>> Anyone got a handy copy of Python 3.6 available to test something for me? >>> >>> What does compile('f"{spam} {eggs}"', '', 'single') r

Re: [Python-Dev] [RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available

2017-12-08 Thread Hasan Diwan
Congrats to all involved! -- Hâ ï -- https://mail.python.org/mailman/listinfo/python-list

Re: we want python software

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 03:45 pm, Abhiram R wrote: > On Wed, Dec 6, 2017 at 10:08 AM, km wrote: > >> I dont know how these students are selected into b tech stream in India. >> they are so dumb. All they know is a to open a program we need to double >> click it and it runs. >> >> We were all once "dum

Re: Python homework

2017-12-08 Thread ssghotra1997
import random def rollDie(num): sides = {'One':0, 'Two':0,'Three':0,'Four':0,'Five':0,'Six':0} for i in range(num): rolls = int(random.randint(1, 6)) if rolls == 1: sides['One'] += 1 if rolls == 2: sides['Two'] += 1 if rolls == 3:

Re: we want python software

2017-12-08 Thread Ethan Furman
On 12/05/2017 09:27 PM, km wrote: [snip] Many things in this world are frustrating, but being hateful will not solve anything. Please control yourself. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: we want python software

2017-12-08 Thread Rustom Mody
On Wednesday, December 6, 2017 at 3:10:24 AM UTC+5:30, Igor Korot wrote: > Hi, Tony, > > On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff wrote: > > On 05/12/17 16:55, Igor Korot wrote: > >> Hi, > >> > >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy wrote: > >>> Sir, > >>> I am b.

Re: we want python software

2017-12-08 Thread Abhiram R
On Wed, Dec 6, 2017 at 10:08 AM, km wrote: > I dont know how these students are selected into b tech stream in India. > they are so dumb. All they know is a to open a program we need to double > click it and it runs. > > â ïWe were all once "dumb". We learnt it because someone Taught us. I'd rath

Re: f-string

2017-12-08 Thread John Pote
On 06/12/2017 00:16, Steve D'Aprano wrote: > Anyone got a handy copy of Python 3.6 available to test something for me? > > What does compile('f"{spam} {eggs}"', '', 'single') return? > > What does eval()'ing the above compiled object do? If necessary, you may have > to define spam and eggs first.

[RELEASE] Python 3.6.4rc1 and 3.7.0a3 now available for testing

2017-12-08 Thread Ned Deily
Announcing the immediate availability of Python 3.6.4 release candidate 1 and of Python 3.7.0 alpha 3! Python 3.6.4rc1 is the first release candidate for Python 3.6.4, the next maintenance release of Python 3.6. While 3.6.4rc1 is a preview release and, thus, not intended for production environmen

Re: f-string

2017-12-08 Thread Ned Batchelder
On 12/5/17 7:16 PM, Steve D'Aprano wrote: > compile('f"{spam} {eggs}"', '', 'single') $ python3.6 Python 3.6.3 (default, Octâ 4 2017, 06:03:25) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin Type "help", "copyright", "credits" or "license" for more information.

Re: f-string

2017-12-08 Thread MRAB
On 2017-12-06 00:16, Steve D'Aprano wrote: > Anyone got a handy copy of Python 3.6 available to test something for me? > > What does compile('f"{spam} {eggs}"', '', 'single') return? > > What does eval()'ing the above compiled object do? If necessary, you may have > to define spam and eggs first. >

Re: Python homework

2017-12-08 Thread MRAB
On 2017-12-06 01:33, nick.martinez2--- via Python-list wrote: > I have a question on my homework. My homework is to write a program in which the computer simulates the rolling of a die 50 > times and then prints > (i). the most frequent side of the die > (ii). the average die value of all rolls. >

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Rick Johnson
Steve D'Aprano wrote: [...] > You've already been told that there's no indication or > reason to believe that it is a non-action. You've already > been given at least one possible action. It isn't a non- > action, it is two distinct actions: > > - the action you take when the slice is non-empty;

Re: csv.DictReader line skipping should be considered a bug?

2017-12-08 Thread Steve D'Aprano
On Wed, 6 Dec 2017 04:20 am, Jason wrote: > I ran into this: > https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-empty -lines > > # unlike the basic reader, we prefer not to return blanks, > # because we will typically wind up with a dict full of None > # values > > while i

Python homework

2017-12-08 Thread nick martinez2 via Python-list
I have a question on my homework. My homework is to write a program in which the computer simulates the rolling of a die 50 times and then prints (i). the most frequent side of the die (ii). the average die value of all rolls. I wrote the program so it says the most frequent number out of all the r

Re: we want python software

2017-12-08 Thread Tony van der Hoff
On 05/12/17 16:55, Igor Korot wrote: > Hi, > > On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy > wrote: >> Sir, >> I am b.tech student I would like to learn python. So please send the python software. > Sorry, we don't send anything. You will have to go get it yourself. -) > Well, at l

Re: f-string

2017-12-08 Thread Chris Angelico
On Wed, Dec 6, 2017 at 11:54 AM, John Pote wrote: > > On 06/12/2017 00:16, Steve D'Aprano wrote: >> >> Anyone got a handy copy of Python 3.6 available to test something for me? >> >> What does compile('f"{spam} {eggs}"', '', 'single') return? >> >> What does eval()'ing the above compiled object do

Re: Please tell me how to execute python file in Ubuntu by double click

2017-12-08 Thread Steve D'Aprano
On Tue, 5 Dec 2017 07:58 pm, Lawrence Dâ ÖOliveiro wrote: > On Tuesday, December 5, 2017 at 3:39:26 AM UTC+13, Rick Johnson wrote: >> >> Sounds like your OS file associations are all botched-up ... > > Linux doesnâ Öt do â £OS file associationsâ Ø. Then how does my Linux box know that when I dou

Re: f-string

2017-12-08 Thread Chris Angelico
On Wed, Dec 6, 2017 at 11:16 AM, Steve D'Aprano wrote: > Anyone got a handy copy of Python 3.6 available to test something for me? > > What does compile('f"{spam} {eggs}"', '', 'single') return? > > What does eval()'ing the above compiled object do? If necessary, you may have > to define spam and

Re: csv.DictReader line skipping should be considered a bug?

2017-12-08 Thread MRAB
On 2017-12-06 00:06, Steve D'Aprano wrote: > On Wed, 6 Dec 2017 04:20 am, Jason wrote: > >> I ran into this: >> > https://stackoverflow.com/questions/27707581/why-does-csv-dictreader-skip-emp ty-lines >> >> # unlike the basic reader, we prefer not to return blanks, >> # because we will typically wi

f-string

2017-12-08 Thread Steve D'Aprano
Anyone got a handy copy of Python 3.6 available to test something for me? What does compile('f"{spam} {eggs}"', '', 'single') return? What does eval()'ing the above compiled object do? If necessary, you may have to define spam and eggs first. Thanks in advance. -- Steve â £Cheer up,â Ø they s

Re: we want python software

2017-12-08 Thread Igor Korot
Hi, Tony, On Tue, Dec 5, 2017 at 11:10 AM, Tony van der Hoff wrote: > On 05/12/17 16:55, Igor Korot wrote: >> Hi, >> >> On Tue, Dec 5, 2017 at 9:10 AM, Jyothiswaroop Reddy >> wrote: >>> Sir, >>> I am b.tech student I would like to learn python. So please send the python software. >> Sorr

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Neil Cerutti writes: > On 2017-12-04, Cecil Westerhof wrote: >> Joel Goldstick writes: >> >>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder >>> wrote: >>> On 12/4/17 4:36 AM, Cecil Westerhof wrote: > I have a script that was running perfectly for some time. It uses: > a

Re: How to upload to Pythonhosted.org

2017-12-08 Thread waylan
After asking here, I found a mailing list post here: https://mail.python.org/pipermail/distutils-sig/2015-May/026381.html That post outlines a roadmap for shutting down pythonhosted. Unfortunately, it seems that they skipped from step 1 to step 5 without bothering with steps 2, 3, & 4. In any eve

why won't slicing lists raise IndexError?

2017-12-08 Thread Jason Maldonis
I was extending a `list` and am wondering why slicing lists will never raise an IndexError, even if the `slice.stop` value if greater than the list length. Quick example: my_list = [1, 2, 3] my_list[:100] # does not raise an IndexError, but instead returns the full list Is there any background

Re: csv.DictReader line skipping should be considered a bug?

2017-12-08 Thread Skip Montanaro
> And I want to argue that the difference of behavior should be considered a bug. Sorry, that ship has sailed. If you want different behavior, subclassing DictReader and providing your own next() implementation should be straightforward. All you need to do is copy the existing implementation of ne

Re: How to use a regexp here

2017-12-08 Thread Neil Cerutti
On 2017-12-04, Cecil Westerhof wrote: > Joel Goldstick writes: > >> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder >> wrote: >> >>> On 12/4/17 4:36 AM, Cecil Westerhof wrote: >>> I have a script that was running perfectly for some time. It uses: array = [elem for elem in output if

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Random832
On Mon, Dec 4, 2017, at 13:54, Jason Maldonis wrote: > Is there any background on why that doesn't raise an IndexError? Knowing > that might help me design my extended list class better. For my specific > use case, it would simplify my code (and prevent `if isinstance(item, > slice)` checks) if the

Re: How to use a regexp here

2017-12-08 Thread Terry Reedy
On 12/4/2017 11:14 AM, Ned Batchelder wrote: > On 12/4/17 9:13 AM, Rick Johnson wrote: >> Perhaps it's not politically correct for me to say this, but >> i've never been one who cared much about political >> correctness, so i'm just going to say it... > > Cecil, feel free to ignore the rest of Rick

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-08 Thread Rick Johnson
On Monday, December 4, 2017 at 3:49:11 AM UTC-6, dhananjays...@gmail.com wrote: > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when > i am double click in python program (Dhananjay.py),it is > opening in Text Editor by Default in Ubuntu.I want to run > this program when i double click on i

Re: How to use a regexp here

2017-12-08 Thread Ned Batchelder
On 12/4/17 9:13 AM, Rick Johnson wrote: > Perhaps it's not politically correct for me to say this, but > i've never been one who cared much about political > correctness, so i'm just going to say it... Cecil, feel free to ignore the rest of Rick's message.â His messages are famous for their outra

Re: How to use a regexp here

2017-12-08 Thread Joel Goldstick
On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder wrote: > On 12/4/17 4:36 AM, Cecil Westerhof wrote: > >> I have a script that was running perfectly for some time. It uses: >> array = [elem for elem in output if 'CPU_TEMP' in elem] >> >> But because output has changed, I have to check for CPU_

Re: How to use a regexp here

2017-12-08 Thread Rick Johnson
Cecil Westerhof wrote: > Joel Goldstick writes: [...] > > I like Ned's clear answer, but I'm wondering why the > > original code would fail because the substring is at the > > start of the line, since 'in' would still be true no > > matter where the desired string is placed. It would be > > usef

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Joel Goldstick writes: > On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder > wrote: > >> On 12/4/17 4:36 AM, Cecil Westerhof wrote: >> >>> I have a script that was running perfectly for some time. It uses: >>> array = [elem for elem in output if 'CPU_TEMP' in elem] >>> >>> But because output h

Re: How to use a regexp here

2017-12-08 Thread Ned Batchelder
On 12/4/17 4:36 AM, Cecil Westerhof wrote: > I have a script that was running perfectly for some time. It uses: > array = [elem for elem in output if 'CPU_TEMP' in elem] > > But because output has changed, I have to check for CPU_TEMP at the > beginning of the line. What would be the best way

Re: urllib2 urlopen takes too much time

2017-12-08 Thread Python
On Sun, Dec 03, 2017 at 09:49:45AM -0800, cpol...@vt.edu wrote: > On Tuesday, June 23, 2009 at 11:09:30 PM UTC-4, Aahz wrote: > > In article , > > =?UTF-8?Q?Filip_Gruszczy=C5=84ski?= wrote: > > > > > >I have encountered a performance problem using suds, which was traced > > >down to _socket.recv.

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Ned Batchelder writes: > On 12/4/17 4:36 AM, Cecil Westerhof wrote: >> I have a script that was running perfectly for some time. It uses: >> array = [elem for elem in output if 'CPU_TEMP' in elem] >> >> But because output has changed, I have to check for CPU_TEMP at the >> beginning of the l

Re: Please tell me how to execute python file in Ubuntu by double

2017-12-08 Thread Thomas Jollans
On 2017-12-04 10:48, dhananjaysingh091...@gmail.com wrote: > Respected Sir/Mam, > I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am double click in python program (Dhananjay.py),it is opening in Text Editor by Default in Ubuntu.I want to run this program when i double click on

Re: Meaning of "Add Python to environment variables"

2017-12-08 Thread Thomas Jollans
On 03/12/17 18:32, John Yeung wrote: > In the custom installation options for Python 3.6, what *exactly* does "Add Python to environment variables" mean? > > Which environment variables are we talking about? I imagine one of them would have to be PATH. Are there any others? If the note on the "Pr

pip3 file in Scripts folder is missing - Python installation - Tensor

2017-12-08 Thread pavan kopparthi
Hi, Installed Python 3.6.3 Amd64 in Windows 10 OS. Want to install Tensor flow using native pip as suggested... C:\> *pip3 install --upgrade tensorflow* But, observed that pip3 file in Scripts folder is missing. Also, Scripts folder is empty. Reg, Pavan Kumar K.

Please tell me how to execute python file in Ubuntu by double

2017-12-08 Thread dhananjaysingh091298
Respected Sir/Mam, I am Dhananjay Singh,Student of IIIT Manipur. Sir/Mam when i am double click in python program (Dhananjay.py),it is opening in Text Editor by Default in Ubuntu.I want to run this program when i double click on it as any *.Exe file executes as in Window. Sir please help me

scipy

2017-12-08 Thread Larry Martell
Trying to install scipy on ubuntu-trusty-64 running Python 2.7.6. It's failing with: $ sudo pip install scipy Downloading/unpacking scipy Downloading scipy-1.0.0.tar.gz (15.2MB): 15.2MB downloaded Running setup.py (path:/tmp/pip_build_root/scipy/setup.py) egg_info for package scipy /usr/li

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Python
On Fri, Dec 08, 2017 at 05:12:35AM -0800, Rick Johnson wrote: > I have already backed my argument with multiple code > examples, exhaustive explanations Which were all false and/or nonsensical. > > if item: > > process(item) > > else: > > do_without_item() > > The above c

Re: asyncio awaitable object

2017-12-08 Thread Ian Kelly
On Fri, Dec 8, 2017 at 2:08 AM, ast wrote: > Hello, > > According to: https://www.python.org/dev/peps/pep-0492/#await-expression > an awaitable object is: > > - A native coroutine object returned from a native coroutine function > - A generator-based coroutine object returned from a function decor

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Rick Johnson
Python wrote: [...] > > In this snippet (which again, we agreed was an incomplete > academic example): > > if item: > process(item) > else: > do_without_item() > > Can you please explain to me what sort of Python > syntactical construct do_without_item() could be, other > t

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Ned Batchelder
On 12/7/17 9:02 PM, Python wrote: Can you please explain to me Really, you just have to ignore him. --Ned. -- https://mail.python.org/mailman/listinfo/python-list

Re: Anything similar to __END__ in perl

2017-12-08 Thread Karsten Hilbert
On Fri, Dec 08, 2017 at 02:19:13AM -0800, Rustom Mody wrote: > > > Hi, perl has __END__ which ignore all the lines below it. > > > > > > Is there anything similar to __END__ in python? Thanks. > > > > Something similar is: > > > > import sys > > sys.exit() > > That will give syntax (or

Re: Anything similar to __END__ in perl

2017-12-08 Thread Rustom Mody
On Friday, December 8, 2017 at 3:13:56 PM UTC+5:30, Karsten Hilbert wrote: > On Thu, Dec 07, 2017 at 11:55:48PM -0600, Peng Yu wrote: > > > Hi, perl has __END__ which ignore all the lines below it. > > > > Is there anything similar to __END__ in python? Thanks. > > Something similar is: > >

Re: asyncio awaitable object

2017-12-08 Thread ast
"ast" a écrit dans le message de news:5a2a568c$0$3699$426a7...@news.free.fr... I made some experiment. It seems that the iterator shall provide None values, an other value raises an exception: "RuntimeError: Task got bad yield: 1" and in instruction "res = await obj", res got the StopIterati

Re: Anything similar to __END__ in perl

2017-12-08 Thread Karsten Hilbert
On Thu, Dec 07, 2017 at 11:55:48PM -0600, Peng Yu wrote: > Hi, perl has __END__ which ignore all the lines below it. > > Is there anything similar to __END__ in python? Thanks. Something similar is: import sys sys.exit() Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.

asyncio awaitable object

2017-12-08 Thread ast
Hello, According to: https://www.python.org/dev/peps/pep-0492/#await-expression an awaitable object is: - A native coroutine object returned from a native coroutine function - A generator-based coroutine object returned from a function decorated with types.coroutine() - An object with an __a