On Sun, Dec 2, 2018 at 1:20 PM Chris Angelico wrote:
> On Sun, Dec 2, 2018 at 11:08 PM Morten W. Petersen
> wrote:
> >
> > On Sun, Dec 2, 2018 at 12:49 PM Chris Angelico wrote:
> >> To my knowledge, len(x) == len(list(x)) for any core data type that
> >> has a length.
> >
> > >>> len(range(0,10
On Sun, Dec 2, 2018 at 11:08 PM Morten W. Petersen wrote:
>
> On Sun, Dec 2, 2018 at 12:49 PM Chris Angelico wrote:
>> To my knowledge, len(x) == len(list(x)) for any core data type that
>> has a length.
>
> >>> len(range(0,100,3))
> 34
> >>> range(0,100,3).__len__
>
> >>> range(0,100,3).__len__
On Sun, Dec 2, 2018 at 12:49 PM Chris Angelico wrote:
> On Sun, Dec 2, 2018 at 10:36 PM Morten W. Petersen
> wrote:
> > While we're on the subject, I did a test in my Python interpreter:
> >
> > Python 3.6.7 (default, Oct 22 2018, 11:32:17)
> > [GCC 8.2.0] on linux
> > Type "help", "copyright",
On Sun, Dec 2, 2018 at 10:36 PM Morten W. Petersen wrote:
> While we're on the subject, I did a test in my Python interpreter:
>
> Python 3.6.7 (default, Oct 22 2018, 11:32:17)
> [GCC 8.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> range(0,3,100)
> ra
On Sun, Dec 2, 2018 at 2:23 AM Chris Angelico wrote:
> On Sun, Dec 2, 2018 at 11:55 AM Morten W. Petersen
> wrote:
> >
> > On Sat, Dec 1, 2018 at 1:11 AM Chris Angelico wrote:
> >>
> >> On Sat, Dec 1, 2018 at 10:55 AM Morten W. Petersen
> wrote:
> >> > But this raises the question of how to wr
On Sun, Dec 2, 2018 at 11:55 AM Morten W. Petersen wrote:
>
> On Sat, Dec 1, 2018 at 1:11 AM Chris Angelico wrote:
>>
>> On Sat, Dec 1, 2018 at 10:55 AM Morten W. Petersen wrote:
>> > But this raises the question of how to write Python code,
>> > short and sweet, that could handle infinite itera
On Sat, Dec 1, 2018 at 1:11 AM Chris Angelico wrote:
> On Sat, Dec 1, 2018 at 10:55 AM Morten W. Petersen
> wrote:
> > But this raises the question of how to write Python code,
> > short and sweet, that could handle infinite iterators in
> > such an unpack with multiple variables to assign to.
>
On Sat, Dec 1, 2018 at 10:55 AM Morten W. Petersen wrote:
> But this raises the question of how to write Python code,
> short and sweet, that could handle infinite iterators in
> such an unpack with multiple variables to assign to.
>
> Which I guess is mostly theoretical, as there are other
> ways
On Sat, Dec 1, 2018 at 12:25 AM Chris Angelico wrote:
> On Sat, Dec 1, 2018 at 10:18 AM Morten W. Petersen
> wrote:
> >
> > On Fri, Nov 30, 2018 at 7:25 PM Dan Sommers <
> > 2qdxy4rzwzuui...@potatochowder.com> wrote:
> >
> > > On 11/30/18 12:00 PM, Morten W. Petersen wrote:
> > >
> > > > I gues
On Sat, Dec 1, 2018 at 10:18 AM Morten W. Petersen wrote:
>
> On Fri, Nov 30, 2018 at 7:25 PM Dan Sommers <
> 2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> > On 11/30/18 12:00 PM, Morten W. Petersen wrote:
> >
> > > I guess syntax could be added, so that
> > >
> > > a, b, @c = some sequence
>
On Fri, Nov 30, 2018 at 7:25 PM Dan Sommers <
2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 11/30/18 12:00 PM, Morten W. Petersen wrote:
>
> > I guess syntax could be added, so that
> >
> > a, b, @c = some sequence
> >
> > would initialize a and b, and leave anything remaining in c. We cou
On 11/30/18 12:00 PM, Morten W. Petersen wrote:
> I guess syntax could be added, so that
>
> a, b, @c = some sequence
>
> would initialize a and b, and leave anything remaining in c. We could
> then call this @ syntax "teh snek".
Close. ;-) Try this:
a, b, *c = [4, 5, 6, 7]
--
https://ma
On Fri, Nov 30, 2018 at 6:21 PM Dan Sommers <
2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 11/30/18 10:57 AM, Morten W. Petersen wrote:
> > On Fri, Nov 30, 2018 at 4:25 PM Dan Sommers
> <2qdxy4rzwzuui...@potatochowder.com> wrote:
> [...]
> > But since you mention it, why is it necessary to en
On 11/30/18 10:57 AM, Morten W. Petersen wrote:
> On Fri, Nov 30, 2018 at 4:25 PM Dan Sommers
<2qdxy4rzwzuui...@potatochowder.com> wrote:
>> Python validates that the right hand side contains exactly the right
>> number of elements before beginning to unpack, presumably to ensure a
>> successfu
On Fri, Nov 30, 2018 at 4:25 PM Dan Sommers <
2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 11/30/18 7:35 AM, Morten W. Petersen wrote:
>
> > ... but isn't it logical that the
> > string is parsed and split, and then later the unpacking operation fails
> > with an IndexError?
>
> With slightly s
On 11/30/18 7:35 AM, Morten W. Petersen wrote:
... but isn't it logical that the
string is parsed and split, and then later the unpacking operation fails
with an IndexError?
With slightly simpler code and the full text of the exception,
the details becomes more apparent:
>>> x, y = [4]
Traceb
On Fri, Nov 30, 2018 at 4:02 PM Peter Otten <__pete...@web.de> wrote:
> Morten W. Petersen wrote:
>
> > I've been reading up on a bit of C++, Assembler etc. lately, so maybe my
> > mind expected an IndexError because of that, but isn't it logical that
> the
> > string is parsed and split, and the
Morten W. Petersen wrote:
> Hi there.
>
> I was adding a port specification feature to my surveil project as shown
> here:
>
>
https://github.com/morphex/surveil/commit/703318f87c4c450a37944b565a10718ef27b57b4
>
> A bit later I was surprised when the script raised an exception, and that
> I ha
18 matches
Mail list logo