Re: Questioning the effects of multiple assignment

2020-07-07 Thread Kyle Stanley
> > A matter of style, which I like to follow [is it TDD's influence? - or > does it actually come-from reading about DBC (Design by Contract*)?] is > the injunction that one *not* vary the value of a parameter inside a > method/function. > (useful in 'open-box testing' to check both the API and th

Installing Basemap in Jupyter Notebook

2020-07-07 Thread Michio Suginoo
Hi I have a trouble in installing basemap in my local Jupyter Notebook. I used the code below. But it did not work. !conda install -c conda-forge basemap==1.3.0 matplotlib==2.2.2 -y How can I install basemap in my Jupyter Notebook? Thanks Best Regards Mich -- https://mail.python.org/mailman

Re: Questioning the effects of multiple assignment

2020-07-07 Thread dn via Python-list
On 7/07/20 7:44 PM, Kyle Stanley wrote: Can you explain why these two (apparently) logical assignment processes have been designed to realise different result-objects? The reason is because of the conventions chosen in PEP 3132, which implemented the feature in the first place. It wa

Re: Questioning the effects of multiple assignment

2020-07-07 Thread dn via Python-list
On 7/07/20 7:21 PM, Mike Dewhirst wrote: Original message For comparison, here's the original form:- >>> def f( a, *b, c=0 ): ... print( a, type( a ) ) ... print( c, type( c ) ) ... print( b ) ... >>> f( 1, 'two', 3, 'four' ) 1 0 ('two', 3, 'four') Shouldn't

Re: Access last element after iteration

2020-07-07 Thread dn via Python-list
On 8/07/20 12:45 AM, Chris Angelico wrote: On Tue, Jul 7, 2020 at 10:28 PM Frank Millman wrote: Hi all After iterating over a sequence, the final element is still accessible. In this case, the variable 'i' still references the integer 4. Yes, it's guaranteed. It isn't often useful; but the

Re: Bulletproof json.dump?

2020-07-07 Thread J. Pic
Try jsonlight.dumps it'll just work. Le mar. 7 juil. 2020 à 12:53, Adam Funk a écrit : > On 2020-07-06, Adam Funk wrote: > > > On 2020-07-06, Chris Angelico wrote: > >> On Mon, Jul 6, 2020 at 10:11 PM Jon Ribbens via Python-list > >> wrote: > > >>> While I agree entirely with your point, there i

Re: Bulletproof json.dump?

2020-07-07 Thread Stephen Rosen
On Mon, Jul 6, 2020 at 6:37 AM Adam Funk wrote: > Is there a "bulletproof" version of json.dump somewhere that will > convert bytes to str, any other iterables to list, etc., so you can > just get your data into a file & keep working? > Is the data only being read by python programs? If so, cons

Re: Access last element after iteration

2020-07-07 Thread Chris Angelico
On Tue, Jul 7, 2020 at 10:28 PM Frank Millman wrote: > > Hi all > > After iterating over a sequence, the final element is still accessible. > In this case, the variable 'i' still references the integer 4. > Yes, it's guaranteed. It isn't often useful; but the variant where there's a "break" in th

Re: Access last element after iteration

2020-07-07 Thread Jon Ribbens via Python-list
On 2020-07-07, Frank Millman wrote: > After iterating over a sequence, the final element is still accessible. > In this case, the variable 'i' still references the integer 4. ... > Is this guaranteed in Python, or should it not be relied on? It is guaranteed, *except* if the sequence is empty an

Access last element after iteration

2020-07-07 Thread Frank Millman
Hi all After iterating over a sequence, the final element is still accessible. In this case, the variable 'i' still references the integer 4. Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for mo

Re: Bulletproof json.dump?

2020-07-07 Thread Adam Funk
On 2020-07-06, Adam Funk wrote: > On 2020-07-06, Chris Angelico wrote: >> On Mon, Jul 6, 2020 at 10:11 PM Jon Ribbens via Python-list >> wrote: >>> While I agree entirely with your point, there is however perhaps room >>> for a bit more helpfulness from the json module. There is no sensible >>> r

Re: Questioning the effects of multiple assignment

2020-07-07 Thread Kyle Stanley
> > Can you explain why these two (apparently) logical assignment processes > have been designed to realise different result-objects? The reason is because of the conventions chosen in PEP 3132, which implemented the feature in the first place. It was considered to return a tuple for the consiste

RE: Questioning the effects of multiple assignment

2020-07-07 Thread Mike Dewhirst
Original message From: dn via Python-list Date: 7/7/20 16:04 (GMT+10:00) To: 'Python' Subject: Questioning the effects of multiple assignment TLDR; if you are a Python 'Master' then feel free to skim the first part (which you should know hands-down), until the excerpts fro