Re: An endless loop

2017-10-14 Thread Steve D'Aprano
On Sun, 15 Oct 2017 01:43 pm, Dennis Lee Bieber wrote: > On 15 Oct 2017 02:10:15 GMT, r...@zedat.fu-berlin.de (Stefan Ram) declaimed > the following: [...] >>def poly( n, length ): >>i = 0 >>while i < n: >>forward( length ) >>left( 360/n ) >> > > A clear example of why a p

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Ben Bacarisse
Irv Kalb writes: > Thank you! You're welcome. >> Just a data point... It works here: >> >> $ python3 t.py >> Response is: b'156.99\n' >> $ cat t.py >> import urllib.request >> fullURLWithParameters = 'http://finance.yahoo.com/d/quotes.csv?s=aapl&f=l1' >> # read all the data >> response = ur

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
Thank you! > On Oct 14, 2017, at 12:10 PM, Ben Bacarisse wrote: > > Irv Kalb writes: > > Lots of detail snipped. I hope it won't matter... > >> > (_ssl.c:749)> >> >> Huh??? >> >> I've read a bunch of documentation, and it looks like I'm doing >> everything right, but I cannot get this to w

Re: Best practise for passing time as arguments

2017-10-14 Thread Christopher Reimer
On Oct 14, 2017, at 10:44 AM, Thomas Jollans wrote: > >> On 14/10/17 19:34, Stefan Ram wrote: >> r...@zedat.fu-berlin.de (Stefan Ram) writes: >>> a post. Use whatever is appropriate in the special case >>> given, or - to write a general library -, learn the design >>> of a good existing library,

Re: Best practise for passing time as arguments

2017-10-14 Thread Chris Angelico
On Sun, Oct 15, 2017 at 8:15 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> * You get into the habit of posting distro-specific (not just >> OS-specific) commands to global mailing lists. > > And? I don't mind you posting the instructions for any other Linux > distro. Chances are the translatio

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Chris Angelico : > * You get into the habit of posting distro-specific (not just > OS-specific) commands to global mailing lists. And? I don't mind you posting the instructions for any other Linux distro. Chances are the translation into my distro is somewhat obvious. At least it would encourage

Re: Best practise for passing time as arguments

2017-10-14 Thread Chris Angelico
On Sun, Oct 15, 2017 at 7:57 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Sun, Oct 15, 2017 at 5:20 AM, Marko Rauhamaa wrote: >>> Even better: >>> >>>sudo dnf install python3-pytz >> >> How is that better? It's the same thing, packaged differently, and >> thus only available on Red Ha

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Chris Angelico : > On Sun, Oct 15, 2017 at 5:20 AM, Marko Rauhamaa wrote: >> Even better: >> >>sudo dnf install python3-pytz > > How is that better? It's the same thing, packaged differently, and > thus only available on Red Hat-family systems, and depends on the > update cycle of your OS. U

Re: Python 2 -> 3, urllib.urlOpen

2017-10-14 Thread Mark Lawrence via Python-list
On 13/10/17 23:27, Irv Kalb wrote: One of the colleges where I teach has just moved from Python 2 to Python 3. I am in the process of converting my beginning Python class from Python 2 to Python 3. Everything has gone smoothly, until I just tried to convert some code that imports and uses ur

Re: Best practise for passing time as arguments

2017-10-14 Thread Chris Angelico
On Sun, Oct 15, 2017 at 5:20 AM, Marko Rauhamaa wrote: > Thomas Jollans : > >> When working with time zones, the standard library needs a little help. >> Luckily, there's a module for that. https://pypi.python.org/pypi/pytz > > Even better: > >sudo dnf install python3-pytz How is that better?

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Ben Bacarisse
Irv Kalb writes: Lots of detail snipped. I hope it won't matter... > (_ssl.c:749)> > > Huh??? > > I've read a bunch of documentation, and it looks like I'm doing > everything right, but I cannot get this to work. Any other > suggestions to get this 3 line program to work correctly? Just a da

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Thomas Jollans : > When working with time zones, the standard library needs a little help. > Luckily, there's a module for that. https://pypi.python.org/pypi/pytz Even better: sudo dnf install python3-pytz Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread MRAB
On 2017-10-14 18:40, Irv Kalb wrote: On Oct 13, 2017, at 3:27 PM, Irv Kalb wrot If I take the same program and just modify the print statement to add parentheses, then try to run it in Python 3.6 (on a Mac): ... import urllib # set the Yahoo finance url, set stock name, ask for last price f

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): > Of course, you (the OP), should check out > > datetime.datetime > > and > > datetime.timedelta > > from the Python Library. which he mentioned in his post. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Best practise for passing time as arguments

2017-10-14 Thread Thomas Jollans
On 14/10/17 19:34, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >> a post. Use whatever is appropriate in the special case >> given, or - to write a general library -, learn the design >> of a good existing library, like Time4J, first. > > Though in many cases, an ISO 8601 ti

Re: Python 2 -> 3, urllib.urlopen (corrected the case)

2017-10-14 Thread Irv Kalb
> On Oct 13, 2017, at 3:27 PM, Irv Kalb wrot > If I take the same program and just modify the print statement to add > parentheses, then try to run it in Python 3.6 (on a Mac): > > ... > import urllib > > # set the Yahoo finance url, set stock name, ask for last price > fullURLWithParameters =

Re: Best practise for passing time as arguments

2017-10-14 Thread Marko Rauhamaa
Andrew Z : > I wonder what are the "best practises" for passing "time" parameters to > functions? > I noticed that sometimes i pass "time" as a str and then start "massaging" > it into delta or i need this time format or that format. Thats quite > annoying and inconsistent. I do the same thing.

Re: Running flask on AWS SAM

2017-10-14 Thread Frustrated learner
export SERVER_NAME="0.0.0.0:3000 sam local start-api" just exports everything and does not execute. I tried export SERVER_NAME="0.0.0.0:3000" sam local start-api comes back with the same error. Shekar -- https://mail.python.org/mailman/listinfo/python-list

Best practise for passing time as arguments

2017-10-14 Thread Andrew Z
Hello, I wonder what are the "best practises" for passing "time" parameters to functions? I noticed that sometimes i pass "time" as a str and then start "massaging" it into delta or i need this time format or that format. Thats quite annoying and inconsistent. I use word "time" as a general word f

Re: Return str to a callback raise a segfault if used in string formating

2017-10-14 Thread Paul Moore
On 14 October 2017 at 16:06, Vincent Vande Vyvre wrote: > I think I've found the problem, the string (a file path) is modified in c > with "sprintf, snprintf, ..." And I plan to change that with some CPython > equivalent function. Nice :-) Glad you found it. Paul -- https://mail.python.org/mailm

Re: Return str to a callback raise a segfault if used in string formating

2017-10-14 Thread Vincent Vande Vyvre
Le 14/10/17 à 15:59, Stefan Behnel a écrit : Vincent Vande Vyvre schrieb am 13.10.2017 um 13:18: Le 13/10/17 à 12:39, Paul Moore a écrit : As a specific suggestion, I assume the name of the created file is a string object constructed in the C extension code, somehow. The fact that you're gettin

Re: Return str to a callback raise a segfault if used in string formating

2017-10-14 Thread Stefan Behnel
Vincent Vande Vyvre schrieb am 13.10.2017 um 13:18: > Le 13/10/17 à 12:39, Paul Moore a écrit : >> As a specific suggestion, I assume the name of the created file is a >> string object constructed in the C extension code, somehow. The fact >> that you're getting the segfault with some uses of that

BOTLIB #31 released - https://pypi.python.org/pypi/botlib

2017-10-14 Thread Bart Thate
BOTLIB #31 released - https://pypi.python.org/pypi/botlib BOTLIB is a python3 framework to use if you want to program CLI, IRC or XMPP bots. features BOTLIB provides the following features: :: object class save/load to/from a json file. rest serverserve saved

Re: Heroku (was Re: Lies in education [was Re: The "loop and a half"])

2017-10-14 Thread Chris Angelico
On Sat, Oct 14, 2017 at 10:16 PM, Ben Bacarisse wrote: > "Peter J. Holzer" writes: >> Which probably boils down to the question: Why did providers offer PHP >> and not Python? One reason might be that at the time no suitable web >> framework for Python existed (Zope was released in 1999, and I re

test

2017-10-14 Thread Tiglath Suriol
test -- https://mail.python.org/mailman/listinfo/python-list

Re: Lies in education [was Re: The "loop and a half"]

2017-10-14 Thread Chris Angelico
On Sat, Oct 14, 2017 at 10:12 PM, Steve D'Aprano wrote: > But be reasonable, I had just asked almost exactly the same question not one > line earlier: > > "If it's read-only, how can the compiler write to it?" > > and (as far as I can see) *nobody* thought to actually answer my question > unti

Re: Heroku (was Re: Lies in education [was Re: The "loop and a half"])

2017-10-14 Thread Ben Bacarisse
"Peter J. Holzer" writes: > On 2017-10-13 21:42, Ben Bacarisse wrote: >> That's one way to put it. Another is that to use Python I need to buy a >> new service that is already configured. > > That's exactly the same for PHP. You can't use that either unless > somebody configured to server to us

Re: Lies in education [was Re: The "loop and a half"]

2017-10-14 Thread Steve D'Aprano
On Sat, 14 Oct 2017 08:26 pm, Peter J. Holzer wrote: > On 2017-10-14 01:05, Steve D'Aprano wrote: >> In context, we are talking about a computer program (the compiler) writing >> data to memory. > > No, I don't think so. You keep talking about that, even though Gregory > hasn't used those exact

Re: Heroku (was Re: Lies in education [was Re: The "loop and a half"])

2017-10-14 Thread alister via Python-list
On Sat, 14 Oct 2017 11:41:08 +0200, Peter J. Holzer wrote: > On 2017-10-13 21:42, Ben Bacarisse wrote: >> That's one way to put it. Another is that to use Python I need to buy >> a new service that is already configured. > > That's exactly the same for PHP. You can't use that either unless > so

Re: Heroku (was Re: Lies in education [was Re: The "loop and a half"])

2017-10-14 Thread Peter J. Holzer
On 2017-10-13 21:42, Ben Bacarisse wrote: > That's one way to put it. Another is that to use Python I need to buy a > new service that is already configured. That's exactly the same for PHP. You can't use that either unless somebody configured to server to use it. The difference is that lots of

Re: Lies in education [was Re: The "loop and a half"]

2017-10-14 Thread Peter J. Holzer
On 2017-10-14 01:05, Steve D'Aprano wrote: > On Sat, 14 Oct 2017 07:15 am, Peter J. Holzer wrote: >> On 2017-10-13 15:11, alister wrote: >>> On Sat, 14 Oct 2017 01:48:44 +1300, Gregory Ewing wrote: Steve D'Aprano wrote: > I wasn't questioning where the data came from, but how the compile