Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
On 03May2023 17:52, Artie Ziff wrote: The code came from a video course, "Pandas Data Analysis with Python Fundamentals" by Daniel Chen. I am curious why the author may have said this. To avoid attaching screenshots, I'll describe this section of the content. Perhaps someone can say, "oh that's

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Artie Ziff
I agree with your analysis, Cameron. The code came from a video course, "Pandas Data Analysis with Python Fundamentals" by Daniel Chen. I am curious why the author may have said this. To avoid attaching screenshots, I'll describe this section of the content. Perhaps someone can say, "oh that's ho

Re: An "adapter", superset of an iterator

2023-05-03 Thread Greg Ewing via Python-list
On 4/05/23 9:29 am, Chris Angelico wrote: So you're asking for map to be able to return an iterator if given an iterator, or an adapter if given an adapter. That makes it quite complicated to use and reason about. Also a bit slower, since it would need to inspect its argument and decide what to

RE: An "adapter", superset of an iterator

2023-05-03 Thread avi.e.gross
As others have mentioned features added like this need careful examination not only at effects but costs. As I see it, several somewhat different ideas were raised and one of them strikes me oddly. The whole point of an iterable is to AVOID calculating the next item till needed. Otherwise, you can

Re: An "adapter", superset of an iterator

2023-05-03 Thread Chris Angelico
On Thu, 4 May 2023 at 07:43, Thomas Passin wrote: > > On 5/3/2023 3:46 PM, Oscar Benjamin wrote: > > On Wed, 3 May 2023 at 18:52, Thomas Passin wrote: > >> > >> On 5/3/2023 5:45 AM, fedor tryfanau wrote: > >>> I've been using python as a tool to solve competitive programming problems > >>> for a

Re: An "adapter", superset of an iterator

2023-05-03 Thread Thomas Passin
On 5/3/2023 3:46 PM, Oscar Benjamin wrote: On Wed, 3 May 2023 at 18:52, Thomas Passin wrote: On 5/3/2023 5:45 AM, fedor tryfanau wrote: I've been using python as a tool to solve competitive programming problems for a while now and I've noticed a feature, python would benefit from having. Cons

Re: An "adapter", superset of an iterator

2023-05-03 Thread Chris Angelico
On Thu, 4 May 2023 at 02:25, fedor tryfanau wrote: > > I've been using python as a tool to solve competitive programming problems > for a while now and I've noticed a feature, python would benefit from > having. > Consider "reversed(enumerate(a))". This is a perfectly readable code, > except it's

Re: An "adapter", superset of an iterator

2023-05-03 Thread Oscar Benjamin
On Wed, 3 May 2023 at 18:52, Thomas Passin wrote: > > On 5/3/2023 5:45 AM, fedor tryfanau wrote: > > I've been using python as a tool to solve competitive programming problems > > for a while now and I've noticed a feature, python would benefit from > > having. > > Consider "reversed(enumerate(a))

Re: An "adapter", superset of an iterator

2023-05-03 Thread Thomas Passin
On 5/3/2023 5:45 AM, fedor tryfanau wrote: I've been using python as a tool to solve competitive programming problems for a while now and I've noticed a feature, python would benefit from having. Consider "reversed(enumerate(a))". This is a perfectly readable code, except it's wrong in the curren

Re: Editing PEP-8, in particular "expected 2 blanks, found 1

2023-05-03 Thread Roy Hann
Kevin M. Wilson wrote: > Folks, help please! What the @#$! are these doing popping up. Code styles are > personal, and not subject to debate. [snip] "Expected 2 blanks"? Or "Expected 2 blank _lines_"? Two blank lines between function/method definitions has been recommended for more than 20 year

An "adapter", superset of an iterator

2023-05-03 Thread fedor tryfanau
I've been using python as a tool to solve competitive programming problems for a while now and I've noticed a feature, python would benefit from having. Consider "reversed(enumerate(a))". This is a perfectly readable code, except it's wrong in the current version of python. That's because enumerate

Re: double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Cameron Simpson
On 03May2023 03:41, Artie Ziff wrote: I am hope that pandas questions are OK here. There are some pandas users here. In a panda lecture, I did not get the expected result. I tried this on two different platforms (old macOS distro and up-to-date Ubuntu Linux distro, 22.04) The Linux distro h

double bracket integer index in pandas; Is this a legal syntax

2023-05-03 Thread Artie Ziff
Hello, I am hope that pandas questions are OK here. In a panda lecture, I did not get the expected result. I tried this on two different platforms (old macOS distro and up-to-date Ubuntu Linux distro, 22.04) The Linux distro has: python3.10.11 pandas1.5.2