Re: [Tutor] beginning to code

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 02:57 pm, Bill wrote: > I find Python to be more more > like Java, with regard to "passing objects by reference". Which is not a surprise, since both Python and Java use the same value passing style: pass by object reference, or pass by sharing if you prefer. Java people don'

Re: Old Man Yells At Cloud

2017-09-21 Thread Paul Rubin
Steve D'Aprano writes: > Having to spend a few hours being paid to migrate code using "print x" > to "print(x)", or even a few months, is not a life-changing experience. Didn't someone further up the thread mention some company that had spent 1.5 years porting a py2 codebase to py3? The issue of

Re: [Tutor] beginning to code

2017-09-21 Thread Bill
Stefan Ram wrote: Bill writes: "Essential Reference", and I would say that Python is definitely a bigger, and more complicated language than C++. In some aspects it has simpler syntax. But consider all of the ways that you can pass arguments to a function, for instance. There are definitely a

Re: Old Man Yells At Cloud

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 02:00 pm, Rick Johnson wrote: > I think it's grossly unfair to label those who's lives > have been up-ended by the backwards incompatible changes of > Python3 as "haters". Nobody, not one person, has ever had their life upended by Python 3. People have their lives upended by

Re: Old Man Yells At Cloud

2017-09-21 Thread Rick Johnson
On Thursday, September 21, 2017 at 10:12:25 AM UTC-5, Steve D'Aprano wrote: > [...] > And remember that the Python core developers feel your pain > too. They had to migrate a large code base (the Python std > library) from 2 to 3. They had to write the 2to3 > translator. And they have to maintain t

Re: [Tutor] beginning to code

2017-09-21 Thread Bill
Stefan Ram wrote: Bill writes: I understand string[::-1] after only studying python for a day or two (I've only been studying it for 2 weeks at this point). A student could study C++ for a semester or more and not encounter templates until they studied data structures. So in short, I don't be

Re: Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
> > > > Thanks Thomas yes you are right with append. I have tried it but just > > can't get it yet as append takes only 1 argument and I wish to give it 3. > > > You have not showed us what you tried, but you are probably missing a pair > of brackets. > > C:\Users\User>python > Python 3.6.0 (v

Re: [Tutor] beginning to code

2017-09-21 Thread Bill
Stefan Ram wrote: Just as Python's »string[::-1]« appears "obfuscated" to readers who don't know Python. I understand string[::-1] after only studying python for a day or two (I've only been studying it for 2 weeks at this point). A student could study C++ for a semester or more and not e

Re: [Tutor] beginning to code

2017-09-21 Thread Bill
Stefan Ram wrote: Bill writes: Stefan Ram wrote: bartc writes: On 20/09/2017 02:31, Bill wrote: it's implementation, I would say that C++ has it all over Python from the point of view of "intuitiveness". It's much easier to tell what's going on, at a glance, in a C++ program. You're being

Re: Convert pandas series to string and datetime object

2017-09-21 Thread Peter Otten
zljubi...@gmail.com wrote: > I have sliced the pandas dataframe > > end_date = df[-1:]['end'] > > type(end_date) > Out[4]: pandas.core.series.Series > > end_date > Out[3]: > 48173 2017-09-20 04:47:59 > Name: end, dtype: datetime64[ns] > > 1.How to get rid of index value 48173 and get onl

Re: Convert pandas series to string and datetime object

2017-09-21 Thread MRAB
On 2017-09-21 20:27, zljubi...@gmail.com wrote: I have sliced the pandas dataframe end_date = df[-1:]['end'] type(end_date) Out[4]: pandas.core.series.Series end_date Out[3]: 48173 2017-09-20 04:47:59 Name: end, dtype: datetime64[ns] 1. How to get rid of index value 48173 and get only

Re: iPython ? magic

2017-09-21 Thread Pavol Lisy
On 9/21/17, Steve D'Aprano wrote: > In the iPython interactive interpreter, obj? prints information about the > given > object. For example: > > > In [11]: None? > Type: NoneType > Base Class: > String Form:None > Namespace: Python builtin > Docstring: > > > Does anyone know that the Nam

Re: Test Bank for Management, Operations Management, Supply Chain Management, Project Management for all editions

2017-09-21 Thread louisacorey
Organizational Behavior and Management, 11th Edition by Robert Konopaske and John Ivancevich and Michael Matteson -- https://mail.python.org/mailman/listinfo/python-list

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/21/2017 10:11 AM, Ned Batchelder wrote: I can only assume that the actual data being read is different than the data they put into the message here. --Ned. There was a typo in the file that I had made and saved; an extra comma before one of the ":". Apologies to the list for not catchi

Convert pandas series to string and datetime object

2017-09-21 Thread zljubisic
I have sliced the pandas dataframe end_date = df[-1:]['end'] type(end_date) Out[4]: pandas.core.series.Series end_date Out[3]: 48173 2017-09-20 04:47:59 Name: end, dtype: datetime64[ns] 1. How to get rid of index value 48173 and get only "2017-09-20 04:47:59" string? I have to call RE

Re: How does CPython build it's NEWS or changelog?

2017-09-21 Thread Ben Finney
Stefan Behnel writes: > https://docs.python.org/devguide/committing.html#what-s-new-and-news-entries > > https://github.com/larryhastings/blurb Also of interest is the more general-use Town Crier tool: towncrier is a utility to produce useful, summarised news files for your project. Rat

Re: [Tutor] beginning to code

2017-09-21 Thread Bill
Stefan Ram wrote: bartc writes: On 20/09/2017 02:31, Bill wrote: it's implementation, I would say that C++ has it all over Python from the point of view of "intuitiveness". It's much easier to tell what's going on, at a glance, in a C++ program. You're being serious, aren't you? For one

Re: Assertions

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 3:49 AM, Steve D'Aprano wrote: > On Fri, 22 Sep 2017 03:31 am, Chris Angelico wrote: > >> Impressive. That means that, in 2.7, it's actually equivalent to: >> > def test3(): >> ... if not foo: raise AssertionError, "bar baz" > > That's nothing. In 1.5 (yes, *one* po

Re: Assertions

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 03:31 am, Chris Angelico wrote: > On Fri, Sep 22, 2017 at 3:23 AM, Steve D'Aprano > wrote: >> That is definitely version-dependent, because I've just tried it and got >> different byte-code in Python 2.7. >> >> py> import dis >> py> def test1(): >> ... assert foo, "bar baz

Re: Assertions

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 02:29 am, Tobiah wrote: > Are these completely equivalent? > > def foo(thing): > > assert(thing > 0), "Thing must be greater than zero" > > > def foo(thing): > > if not (thing > 0): raise AssertionError("Thing must be greater than > zero") > > > O

Re: Old Man Yells At Cloud

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 3:07 AM, Rhodri James wrote: > On 21/09/17 17:31, Chris Angelico wrote: >> >> For a good while, I was in the same position. But instead of massively >> rewriting everything, all I did was to adjust the material to use >> Py2/Py3 compatible syntax. Adding parens around your

Re: Assertions

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 3:23 AM, Steve D'Aprano wrote: > That is definitely version-dependent, because I've just tried it and got > different byte-code in Python 2.7. > > py> import dis > py> def test1(): > ... assert foo, "bar baz" > ... > py> def test2(): > ... if not foo: raise Assertio

Re: Assertions

2017-09-21 Thread Steve D'Aprano
On Fri, 22 Sep 2017 02:59 am, Ned Batchelder wrote: > On 9/21/17 12:29 PM, Tobiah wrote: >> Are these completely equivalent? [... assert, versus test and raise AssertionError ...] > Let's see: [...] > Yes, they are completely equivalent, compiling to precisely the same > bytecode. That is defin

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 21/09/17 17:31, Chris Angelico wrote: For a good while, I was in the same position. But instead of massively rewriting everything, all I did was to adjust the material to use Py2/Py3 compatible syntax. Adding parens around your print calls won't stop it from being Py2-compatible, and it means

Re: Assertions

2017-09-21 Thread Ned Batchelder
On 9/21/17 12:29 PM, Tobiah wrote: Are these completely equivalent? def foo(thing): assert(thing > 0), "Thing must be greater than zero" def foo(thing): if not (thing > 0): raise AssertionError("Thing must be greater than zero") Other than the fact that the assertion can

iPython ? magic

2017-09-21 Thread Steve D'Aprano
In the iPython interactive interpreter, obj? prints information about the given object. For example: In [11]: None? Type: NoneType Base Class: String Form:None Namespace: Python builtin Docstring: Does anyone know that the Namespace field is supposed to show? I can't get it to display

Re: errors with json.loads

2017-09-21 Thread Ned Batchelder
On 9/21/17 12:18 PM, john polo wrote: Bill, Thanks for the reply. I wasn't sure how to get Python 2 through the cmd or IPython, so I went through ArcGIS, but it's mostly the same result: >>> file = open('books.json','r') >>> text = file.read() >>> text = json.loads(text) After the file.read

Re: Old Man Yells At Cloud

2017-09-21 Thread Chris Angelico
On Fri, Sep 22, 2017 at 1:59 AM, Rhodri James wrote: > On 21/09/17 16:12, Steve D'Aprano wrote: >> >> On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: >> >>> (That's basically my gripe against print becoming a function in Python3. >>>It makes a lot of sense as has already been pointed out, bu

Assertions

2017-09-21 Thread Tobiah
Are these completely equivalent? def foo(thing): assert(thing > 0), "Thing must be greater than zero" def foo(thing): if not (thing > 0): raise AssertionError("Thing must be greater than zero") Other than the fact that the assertion can be turned off with -O? Thanks, Tob

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/21/2017 4:24 AM, Thomas Jollans wrote: It looks to me like the root cause of the problem was that they copied the code from a web page, and the web page contained invalid JSON. Thank you, Thomas. John -- https://mail.python.org/mailman/listinfo/python-list

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 6:40 PM, Dennis Lee Bieber wrote: On Wed, 20 Sep 2017 17:13:41 -0500, john polo declaimed the following: and the example code for reading the file is: file = open('books.json','r') What encoding is the file? I did a cut&paste from your post into a file, and the content

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:58 PM, Bill wrote: Interesting problem, John. I have probably even less experience with json than you do, so I'm taking this as an opportunity to learn with you. Suggestions: 1. Try your example with Python 2 rather than Python 3. Bill, Thanks for the reply. I wasn't sure how

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:56 PM, John Gordon wrote: In john polo writes: JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161) ?json.loads says that the method is for deserializing "s", with "s" being a string, bytes, or bytearray. In [24]: type(text) Out[24]: str So "text" seems to be

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 21/09/17 16:12, Steve D'Aprano wrote: On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: (That's basically my gripe against print becoming a function in Python3. It makes a lot of sense as has already been pointed out, but it breaks every beginners tutorial.) Nobody made that decision lig

New security-annou...@python.org mailing list

2017-09-21 Thread Barry Warsaw
I’m happy to announce the availability of a new mailing list, with the mission of providing security announcements to the Python community from the Python Security Response Team (PSRT): security-annou...@python.org You can sign up in the usual Mailman way: https://mail.python.org/mailman/listi

Re: Old Man Yells At Cloud

2017-09-21 Thread Steve D'Aprano
On Thu, 21 Sep 2017 08:19 pm, Rhodri James wrote: > (That's basically my gripe against print becoming a function in Python3. > It makes a lot of sense as has already been pointed out, but it breaks > every beginners tutorial.) Nobody made that decision lightly. It wasn't a spur of the moment de

Re: errors with json.loads

2017-09-21 Thread Ned Batchelder
On 9/20/17 10:35 PM, Bill wrote: Ned Batchelder wrote: On 9/20/17 8:22 PM, Bill wrote: Apparenty an \xa0 byte corresponds to a "non-breaking space". What sort of white space characters are allowed in a json file ( tabs and newlines?)?  Just curious. These things can be looked up.  From RFC

PyDev 6.0.0 Released

2017-09-21 Thread Fabio Zadrozny
PyDev 6.0.0 Release Highlights - *Important* PyDev now requires Java 8 and Eclipse 4.6 (Neon) onwards. - PyDev 5.2.0 is the last release supporting Eclipse 4.5 (Mars). - *Interpreter configuration* - The *list of packages* installed in the interpreter is shown in the IDE

Re: Easy way to get a list of tuples.

2017-09-21 Thread Thomas Jollans
On 2017-09-21 12:38, Sayth Renshaw wrote: > Thanks Thomas yes you are right with append. I have tried it but just can't > get it yet as append takes only 1 argument and I wish to give it 3. > > I am really having trouble creating the groups of 3, since I am getting one > consistent stream. I su

Re: Easy way to get a list of tuples.

2017-09-21 Thread Mark Lawrence via Python-list
On 21/09/2017 11:18, Sayth Renshaw wrote: Hi I have been toying with json and I particular area where I cannot get the desired result a list of tuples as my return. The json from the API is way to long but I don't think it will matter. .. hitting url data = r.json() for item in data["RaceDay

Re: [Tutor] beginning to code

2017-09-21 Thread bartc
On 20/09/2017 02:31, Bill wrote: Rick Johnson wrote: I think for most languages an intuitive syntax is not important -- C is such a language, Lisp is such a language, Perl is such a language, and there are many more -- but for Python, intuitiveness is very important. I guess it depends on what

Re: [Tutor] beginning to code

2017-09-21 Thread Rick Johnson
INADA Naoki wrote: > Rick Johnson wrote [...] > > Of course, allowing all objects to use the `==`, `!=` > > sugars makes perfect sense, but `<`, `>`, `<=`, `>=` are > > meaningless outside of numeric-ish types. > > Now you know why Python 3 was born! It's one of many > pitfalls in Python 2 fixed i

Re: [Tutor] beginning to code

2017-09-21 Thread Rick Johnson
Bill wrote: > Rick Johnson wrote: > > I think for most languages an intuitive syntax is not > > important -- C is such a language, Lisp is such a > > language, Perl is such a language, and there are many more > > -- but for Python, intuitiveness is very important. > > > I guess it depends on what y

Re: Easy way to get a list of tuples.

2017-09-21 Thread Frank Millman
"Sayth Renshaw" wrote in message news:cd4aa5c7-47ee-442b-945e-490b0674e...@googlegroups.com... Thanks Thomas yes you are right with append. I have tried it but just can't get it yet as append takes only 1 argument and I wish to give it 3. You have not showed us what you tried, but you are p

Re: Old Man Yells At Cloud

2017-09-21 Thread Rhodri James
On 19/09/17 19:31, bartc wrote: Can't you get around all those with things like sys.stdout.write? If so, what was the point of having a discrete print statement/function at all? Simplicity. It is much easier to explain to a beginner that print("Wombats are go!") will write something to

Re: Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
On Thursday, 21 September 2017 20:31:28 UTC+10, Thomas Jollans wrote: > On 2017-09-21 12:18, Sayth Renshaw wrote: > > This is my closest code > > > > data = r.json() > > > > raceData = [] > > > > for item in data["RaceDay"]['Meetings'][0]['Races']: > > raceDetails = item['RacingFormGuide'][

Re: Easy way to get a list of tuples.

2017-09-21 Thread Thomas Jollans
On 2017-09-21 12:18, Sayth Renshaw wrote: > This is my closest code > > data = r.json() > > raceData = [] > > for item in data["RaceDay"]['Meetings'][0]['Races']: > raceDetails = item['RacingFormGuide']['Event']['Race'] > raceData += > (raceDetails['Name'],raceDetails['Number'],raceDeta

Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
Hi I have been toying with json and I particular area where I cannot get the desired result a list of tuples as my return. The json from the API is way to long but I don't think it will matter. .. hitting url data = r.json() for item in data["RaceDay"]['Meetings'][0]['Races']: raceDetails

Re: How does CPython build it's NEWS or changelog?

2017-09-21 Thread Stefan Behnel
Hartmut Goebel schrieb am 21.09.2017 um 10:59: > I just discovered that CPython now uses Misc/NEWS.d/next to collect > changes an there are a lot of Misc/NEWS/*.rst files for the respective > released version. I'm investigating whether to adopt this for PyInstaller. > > What is the tooling for thi

Re: How does CPython build it's NEWS or changelog?

2017-09-21 Thread Paul Moore
On 21 September 2017 at 09:59, Hartmut Goebel wrote: > Hello, > > I just discovered that CPython now uses Misc/NEWS.d/next to collect > changes an there are a lot of Misc/NEWS/*.rst files for the respective > released version. I'm investigating whether to adopt this for PyInstaller. > > What is th

Re: Even Older Man Yells at Whippersnappers

2017-09-21 Thread Thomas Jollans
On 2017-09-19 20:21, Stefan Ram wrote: > I do not use UTF-8 > Why on earth not?! -- Thomas Jollans -- https://mail.python.org/mailman/listinfo/python-list

Re: errors with json.loads

2017-09-21 Thread Thomas Jollans
On 2017-09-21 04:35, Bill wrote: > Ned Batchelder wrote: >> >> On 9/20/17 8:22 PM, Bill wrote: >>> Apparenty an \xa0 byte corresponds to a "non-breaking space". What >>> sort of white space characters are allowed in a json file ( tabs and >>> newlines?)?  Just curious. >> >> These things can be lo

Re: How does CPython build it's NEWS or changelog?

2017-09-21 Thread Skip Montanaro
> I just discovered that CPython now uses Misc/NEWS.d/next to collect > changes an there are a lot of Misc/NEWS/*.rst files for the respective > released version. I'm investigating whether to adopt this for PyInstaller. > > What is the tooling for this? Is there some documentation, maybe a > mailin

Re: Fwd: Issues with python commands in windows powershell

2017-09-21 Thread Thomas Jollans
On 2017-09-20 21:52, Terry Reedy wrote: > On 9/20/2017 1:09 PM, Joey Steward wrote: >> -- Forwarded message -- >> From: Joey Steward >> Date: Tue, Sep 19, 2017 at 10:30 PM >> Subject: Issues with python commands in windows powershell >> To: python-list@python.org >> >> >> Hello, >>

How does CPython build it's NEWS or changelog?

2017-09-21 Thread Hartmut Goebel
Hello, I just discovered that CPython now uses Misc/NEWS.d/next to collect changes an there are a lot of Misc/NEWS/*.rst files for the respective released version. I'm investigating whether to adopt this for PyInstaller. What is the tooling for this? Is there some documentation, maybe a mailingsl

Re: Old Man Yells At Cloud

2017-09-21 Thread Pavol Lisy
On 9/20/17, Steve D'Aprano wrote: > On Wed, 20 Sep 2017 02:55 pm, Pavol Lisy wrote: Thanks Steve, I agree with most of your mail and really appreciate interesting reading! :) > (a) "you save one character (two keystrokes)"; and First I have to admit that I forgot space! But if we like to be ped