n...
How can this code work??? , when it's
> def chunk1(seq):
and it's [s] within the def-body ?
it seemed as if the Compiler was doing a DWIM (Do what i mean) trick.
On 09/06/2024 22:20, HenHanna via Python-list wr
#x27;, 'c', 'c'], ['singleton']]
>>> chunkC([1, 2, 2, 'c', 'c', 'c', 'singleton'])
[[1, 1], [2, 2], ['c', 3], ['singleton', 1]]
# COMMENTS
The current version has flaws I have not bothered correcting. Jus
##
Program output:
['aaa', 'bb', '', 'aa']
[('a', 3), ('b', 2), ('c', 4), ('a', 2)]
Rob Cliffe
On 09/06/2024 22:20, HenHanna via Python-list wrote:
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Ch
What does it mean for items
in a row to be equal? If I have a sublist, should I unlist to make it flat
first, or should it be an error, or should each such sublist be compared for
full equality or even relative equality so that (a (b c) (c b) d) actually
accepts (b c) and (c b) as the same for the
:20 PM
To: python-list@python.org
Subject: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Chunk '(a a ba a a b b))
==> ((a a) (b) (a a a) (b b))
(Chunk '(a a a a b c
On 6/9/2024 3:50 PM, MRAB wrote:
On 2024-06-09 22:20, HenHanna via Python-list wrote:
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Chunk '(a a b a a a b b))
==> ((a a) (b) (a a a) (b b))
(Chunk '(a a a a b c c a a d e e e e))
? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Chunk '(a a ba a a b b))
==> ((a a) (b) (a a a) (b b))
(Chunk '(a a a a b c c a a d e e e e))
==> ((a a a a) (b)
would
be trivial, perhaps leveraging the above.
-Original Message-
From: Python-list On
Behalf Of HenHanna via Python-list
Sent: Sunday, June 9, 2024 5:20 PM
To: python-list@python.org
Subject: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))
Chunk, ChunkC -- nice si
On 2024-06-09 22:20, HenHanna via Python-list wrote:
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Chunk '(a a b a a a b b))
==> ((a a) (b) (a a a) (b b))
(Chunk '(a a a a b c c a a d e e e e))
==> ((a a a a) (b) (c c) (a
Chunk, ChunkC -- nice simple way(s) to write these in Python?
(Chunk '(a a b a a a b b))
==> ((a a) (b) (a a a) (b b))
(Chunk '(a a a a b c c a a d e e e e))
==> ((a a a a) (b) (c c) (a a) (d) (e e e e))
(Chunk '(2 2 foo bar bar
On 28/02/23 4:24 pm, Hen Hanna wrote:
is it poss. to peek at the Python-list's messages
without joining ?
It's mirrored to the comp.lang.python usenet group, or
you can read it through gmane with a news client.
--
Greg
--
https://mail.python.org/mailman/listinfo/py
t;> print(p2b(nested))
(1, 2, (3, 4, (5, 6, 7), 8), 9)
People who speak python well do not necessarily lisp.
-Original Message-
From: Python-list On
Behalf Of Hen Hanna
Sent: Sunday, February 26, 2023 4:54 AM
To: python-list@python.org
Subject: Re: one Liner: Lisprint(x) --> (a,
On Saturday, February 25, 2023 at 11:45:12 PM UTC-8, Hen Hanna wrote:
> def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n')
>
> a= ' a b c ? def f x if zero? x 0 1 '
> a += ' A B C ! just an example '
> x= a.spli
def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n')
a=' a b c ? def f x if zero? x 0 1 '
a += ' A B C ! just an example '
x= a.split()
print(x)
Lisprint(x)
['a', 'b', 'c', '?',
On Fri, 4 Oct 2019 at 19:02, Hongyi Zhao wrote:
>
> Could you please give me some more hints on:
>
> a &= b
$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license&qu
On Fri, Oct 4, 2019 at 5:01 AM Hongyi Zhao wrote:
>
> Hi,
>
> Could you please give me some more hints on:
>
> a &= b
>
> It's very difficult for me to understand.
> --
> https://mail.python.org/mailman/listinfo/python-list
& is bitwise And. a
Hi,
Could you please give me some more hints on:
a &= b
It's very difficult for me to understand.
--
https://mail.python.org/mailman/listinfo/python-list
side effect of moving the optimization for `x in [a, b]` from
the peepholer to the AST optimizer.
Ah ha. Thank you.
Is it worth trying to reinstate that? On the one hand, there's no
reason to build the list, and this technically is a (performance)
regression. On the other hand, it's
his was a side effect of moving the optimization for `x in [a, b]` from
> the peepholer to the AST optimizer.
>
Ah ha. Thank you.
Is it worth trying to reinstate that? On the one hand, there's no
reason to build the list, and this technically is a (performance)
regression. On the other hand,
02.09.19 12:24, Chris Angelico пише:
But the curious difference happens in 3.7. I don't know what changed
to cause this, but from there on, the list gets built and then
unpacked.
This was a side effect of moving the optimization for `x in [a, b]` from
the peepholer to the AST opti
Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao:
> Hi,
>
> What's differences:
>
> a,b = 2,3 and [a,b] = [2,3]
>
> Regards
In this example the result is the same but the second one
builds, internally, an additional list, therefore isn't as suffici
Hi,
What's differences:
a,b = 2,3 and [a,b] = [2,3]
Regards
--
https://mail.python.org/mailman/listinfo/python-list
gt; tried again:
>
> bash-4.2$ python3 -E
> Python 3.6.6 (default, Aug 13 2018, 18:24:23)
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> def f():
> ...
Chris Angelico writes:
> On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote:
...
> > > > a,b = 2,3 and [a,b] = [2,3]
...
> > It looks to me like they generate identical code. The first one calls the
> > construction of a tuple, where the second one calls for the cons
On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote:
>
> Eko palypse writes:
>
> > Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao:
> > > Hi,
> > >
> > > What's differences:
> > >
> > > a,b = 2,3 and [a,b] = [2,3]
&
Eko palypse writes:
> Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao:
> > Hi,
> >
> > What's differences:
> >
> > a,b = 2,3 and [a,b] = [2,3]
> >
> > Regards
>
> In this example the result is the same but the second
On 4/9/2019 4:24 PM, Christian Gollwitzer wrote:
Am 09.04.19 um 21:57 schrieb CrazyVideoGamez:
What is a, b, c, and d in:
from tkinter import *
window = Tk()
drawing = Canvas(window, height=500, width=500)
rectangle = drawing.create_rectangle(a, b, c, d)
and:
circle = drawing.create_oval(a, b
CrazyVideoGamez wrote:
> What is a, b, c, and d in:
> from tkinter import *
> window = Tk()
> drawing = Canvas(window, height=500, width=500)
> rectangle = drawing.create_rectangle(a, b, c, d)
> and:
> circle = drawing.create_oval(a, b, c, d)
> ???
Here's a picture:
What is a, b, c, and d in:
from tkinter import *
window = Tk()
drawing = Canvas(window, height=500, width=500)
rectangle = drawing.create_rectangle(a, b, c, d)
and:
circle = drawing.create_oval(a, b, c, d)
???
--
https://mail.python.org/mailman/listinfo/python-list
Am 09.04.19 um 21:57 schrieb CrazyVideoGamez:
What is a, b, c, and d in:
from tkinter import *
window = Tk()
drawing = Canvas(window, height=500, width=500)
rectangle = drawing.create_rectangle(a, b, c, d)
and:
circle = drawing.create_oval(a, b, c, d)
???
Look it up in the original Tk
On Fri, Aug 26, 2016 at 8:20 PM, mlz wrote:
> I believe there are languages that preserve exact accuracy in this way for
> rational fractions. I don't know if Python is one of them.
It is, but only if you explicitly request it (due to the performance
impact). Just import it:
#!/usr/bin/python2
mlz writes:
> It's true that a*(b/c) yields fractions which would probably accrue
> accuracy errors depending on how those values are implemented. For
> example, it is possible to represent 1/3 internally as two numbers,
> numerator and denominator, thus avoiding the repe
It's true that a*(b/c) yields fractions which would probably accrue accuracy
errors depending on how those values are implemented. For example, it is
possible to represent 1/3 internally as two numbers, numerator and denominator,
thus avoiding the repeating decimal (or binimal, or whatever
Partly it's the layout, but mathematically speaking the two should be equal.
(a*b)/c should equal a*(b/c)
The fact that they're not is surprising, because python 2 so seamlessly
supports big integers in a mathematically correct way.
I consider such surprising behavior to be abstra
Aha. That's interesting.
On Friday, August 26, 2016 at 2:11:32 AM UTC-7, Peter Otten wrote:
> mlz wrote:
>
> > Yes, I just worked that out. It's the integer math that's the problem.
> >
> > I guess this has been fixed in python 3, but unfortunately it seems that
> > most people are still using
On 26/08/2016 08:14, mlzarathus...@gmail.com wrote:
However, precedence wasn't the problem in this case, it was the type conversion.
I think it was. I was puzzled as well.
But apparently if you have:
x * = expr
That's like:
x = x * (expr)# note the parentheses
which may not al
mlzarathus...@gmail.com wrote:
> Yes, I just worked that out. It's the integer math that's the problem.
>
> I guess this has been fixed in python 3, but unfortunately it seems that
> most people are still using python 2.
Note that you can get Python 3's default behaviour in Python 2 with
from _
ow is this related to your question? The example explicitly says Python
2 and doesn't use the '//' operator.
It's related by the fact that a*b/c performs integer division (intended
by the OP) which gives a different result than a*(b/c) (unintended by
the OP). Floating point (as
On 26/08/16 08:14, mlzarathus...@gmail.com wrote:
I was being facetious, but behind it is a serious point. Neither the APL nor
the J languages use precedence even though their inventor, Ken Iverson, was a
mathematician.
That was to support functional programming dating back to the 1970's.
P
On 26/08/16 08:44, mlzarathus...@gmail.com wrote:
Here's the key:
$ python2
Python 2.7.10 ...
1/2
0
$ python
Python 3.5.1 ...
1/2
0.5
1//2
0
I read about this awhile ago, but it's not until it bites you that you remember
fully.
How is this related to your question? The example e
Here's the key:
$ python2
Python 2.7.10 ...
>>> 1/2
0
>>>
$ python
Python 3.5.1 ...
>>> 1/2
0.5
>>> 1//2
0
>>>
I read about this awhile ago, but it's not until it bites you that you remember
fully.
--
https://mail.python.org/mailman/listinfo/python-list
mlzarathus...@gmail.com writes:
> Yes, I just worked that out. It's the integer math that's the problem.
>
> I guess this has been fixed in python 3 [- -]
Note that division in Python 3 produces approximate results (floating
point numbers). This may or may not be what you want in this exercise.
I
I was being facetious, but behind it is a serious point. Neither the APL nor
the J languages use precedence even though their inventor, Ken Iverson, was a
mathematician.
That was to support functional programming dating back to the 1970's.
However, precedence wasn't the problem in this case, i
Yes, I just worked that out. It's the integer math that's the problem.
I guess this has been fixed in python 3, but unfortunately it seems that most
people are still using python 2.
Thanks for all the help!
--
https://mail.python.org/mailman/listinfo/python-list
mple:
>>> (2*2)/3
1
>>> 2*(2/3)
0
Now "hide" the the order of evaluation:
>>> a, b = 2, 3
>>> a *= a/b
>>> a
0
>>> a, b = 2, 3
>>> a = a*a/b
>>> a
1
> return rs
>
>
> for n in range(10):
On Fri, Aug 26, 2016 at 4:40 PM, wrote:
> Precedence, d'oh!
>
> rs *= (n-(i-1))/i
> is equivalent to:
> rs = rs * ((n-(i-1))/i)
>
> not
> rs = rs * (n-(i-1))/i
>
> which is the same as
> rs = ( rs * (n-(i-1)) ) /i
>
>
> Ken Iverson was right. Precedence is a bad i
Precedence, d'oh!
rs *= (n-(i-1))/i
is equivalent to:
rs = rs * ((n-(i-1))/i)
not
rs = rs * (n-(i-1))/i
which is the same as
rs = ( rs * (n-(i-1)) ) /i
Ken Iverson was right. Precedence is a bad idea.
--
https://mail.python.org/mailman/listinfo/python
if FAIL: rs *= (n-(i-1))/i # these should be the same,
This is equal to rs = rs * ((n-(i-1))/i)
else: rs = rs * (n-(i-1))/i # but apparently are not
This is equal to rs = (rs * (n-(i-1)))/i
On Fri, Aug 26, 2016 at 3:20 PM, mlz wrote:
> I've been playing with the binomial f
mlz writes:
> I've been playing with the binomial function, and found that in the
> below code, rs *= x does not behave the same way as rs = rs * x. When
> I set FAIL to True, I get a different result. Both results are below.
>
> I had read that the two were equivalent. What am I missing?
You do
I've been playing with the binomial function, and found that in the below code,
rs *= x does not behave the same way as rs = rs * x. When I set FAIL to True, I
get a different result. Both results are below.
I had read that the two were equivalent. What am I missing?
thanks,
-= miles =-
#!
On 2/16/2016 7:46 AM, srinivas devaki wrote:
Hi,
a = b = c
as an assignment doesn't return anything, i ruled out a = b = c as
chained assignment, like a = (b = c)
SO i thought, a = b = c is resolved as
a, b = [c, c]
https://docs.python.org/3/reference/simple_stmts.html#assignment-state
On Tue, Feb 16, 2016 at 6:35 PM, Sven R. Kunze wrote:
>
> First, the rhs is evaluated.
> Second, the lhs is evaluated from left to right.
Great, I will remember these two lines :)
On Tue, Feb 16, 2016 at 8:46 PM, Steven D'Aprano wrote:
> _temp = c
> a = _temp
> b = _temp
> del _temp
>
>
> except
On Tue, 16 Feb 2016 11:46 pm, srinivas devaki wrote:
> Hi,
>
> a = b = c
>
> as an assignment doesn't return anything, i ruled out a = b = c as
> chained assignment, like a = (b = c)
> SO i thought, a = b = c is resolved as
> a, b = [c, c]
That is one way of think
(as
you suggested at the beginning).
a,b=b,a=4,5
(a,b),(b,a)=(4,5),(4,5)
Best,
Sven
--
https://mail.python.org/mailman/listinfo/python-list
Hi Srinivas,
On 16.02.2016 13:46, srinivas devaki wrote:
Hi,
a = b = c
as an assignment doesn't return anything, i ruled out a = b = c as
chained assignment, like a = (b = c)
SO i thought, a = b = c is resolved as
a, b = [c, c]
at-least i fixed in my mind that every assignment
Hi,
a = b = c
as an assignment doesn't return anything, i ruled out a = b = c as
chained assignment, like a = (b = c)
SO i thought, a = b = c is resolved as
a, b = [c, c]
at-least i fixed in my mind that every assignment like operation in
python is done with references and then the refer
On 8/26/2015 2:14 PM, Grant Edwards wrote:
On 2015-08-26, Emile van Sebille wrote:
On 8/26/2015 9:06 AM, Grant Edwards wrote:
It's also unfortunate that there's no way to
to access the mailing list via an NNTP server
Huh? -- gmane.comp.python.general at
news://nntp.gmane.com:119/gmane.comp.p
On Wed, Aug 26, 2015 at 12:11 PM, Andy Kubiak wrote:
> What if you could send all your mail to another address on a server you
> control, or can at least run programs on?
That seems like a lot more hassle than it would be worth.
--
https://mail.python.org/mailman/listinfo/python-list
On 2015-08-26, Emile van Sebille wrote:
> On 8/26/2015 9:06 AM, Grant Edwards wrote:
>> It's also unfortunate that there's no way to
>> to access the mailing list via an NNTP server
>
> Huh? -- gmane.comp.python.general at
> news://nntp.gmane.com:119/gmane.comp.python.general
>
> Or do you mean by
On 8/26/2015 9:06 AM, Grant Edwards wrote:
It's also unfortunate that there's no way to
to access the mailing list via an NNTP server
Huh? -- gmane.comp.python.general at
news://nntp.gmane.com:119/gmane.comp.python.general
Or do you mean by the OP?
Emile
--
https://mail.python.org/mailman/l
>
> I wish I could, problem is, if the mail recipient is within the company,
> no legal boilerplate is added making the joke fall flat.
>
What if you could send all your mail to another address on a server you
control, or can at least run programs on?
Could you configure all your outgoing mail to
- Original Message -
> From: "Chris Angelico"
> Cc: python-list@python.org
> Sent: Wednesday, 26 August, 2015 6:11:51 PM
> Subject: Re: Please don't make unfounded legalistic demands (was: [a, b, c,
> d] = 1, 2, 3, 4)
>
> On Thu, Aug 27, 2015 at 1:
On Thu, Aug 27, 2015 at 1:09 AM, Terry Reedy wrote:
> How about instead you augment your signature with "Please ignore the
> boilerplate below.
Heh, I like this! Or:
"""
-- BOILERPLATE TROPHY COLLECTION
I am a collector of stupid legal boilerplate. Here's my latest acquisition:
"""
Then let yo
On 2015-08-26, Terry Reedy wrote:
> On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote:
>>> Misleading, intimidating, hostile nonsense.
>
> Agreed.
>
>>> If you want to participate here, please do so from a mail system
> >> which does not make these legalistic demands.
>
> I disagree with prohibit
On Wednesday 26 August 2015 11:09:18 Terry Reedy wrote:
> On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote:
> > - Original Message -
> >
> >> From: "Ben Finney"
> >>
> >>> The contents of this email and any attachments are confidential
> >>> and may also be privileged. If you are not the
On 8/26/2015 8:21 AM, Tim Chase wrote:
a, b, c = (x for x in range(3)) # a generator for instance
Since range() *is* a generator, why not just use
In Python 3, range is a sequence class with a separate iterator class
>>> r = range(3)
>>> r
range(0, 3)
>>> iter
On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote:
- Original Message -
From: "Ben Finney"
The contents of this email and any attachments are confidential and
may also be privileged. If you are not the intended recipient,
please
notify the sender immediately and do not disclose the con
- Original Message -
> From: "Ben Finney"
> > The contents of this email and any attachments are confidential and
> > may also be privileged. If you are not the intended recipient,
> > please
> > notify the sender immediately and do not disclose the contents to
> > any
> > other person, us
- Original Message -
> From: "Chris Angelico"
> Cc: python-list@python.org
> Sent: Wednesday, 26 August, 2015 3:04:05 PM
> Subject: Re: [a,b,c,d] = 1,2,3,4
>
> On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant
> wrote:
> > To add to Joel
On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant
wrote:
> To add to Joel's answer, the right side can be *any* sequence, and is not
> restricted to lists or tuples.
>
> a, b, c = (x for x in range(3)) # a generator for instance
FWIW, a generator is not a sequence; this
> >>> a
> > (1, 2, 3)
> > >>> a[1]
> > 2
>
> To add to Joel's answer, the right side can be *any* sequence, and
> is not restricted to lists or tuples.
>
> a, b, c = (x for x in range(3)) # a generator for instance
Since range() *
Jean-Michel Pichavant writes:
> -- IMPORTANT NOTICE:
>
> The contents of this email and any attachments are confidential and
> may also be privileged. If you are not the intended recipient, please
> notify the sender immediately and do not disclose the contents to any
> other person, use it for
Joel's answer, the right side can be *any* sequence, and is not
restricted to lists or tuples.
a, b, c = (x for x in range(3)) # a generator for instance
That would be a generator unpacking combined with a tuple packing (is packing
restricted to tuples and lists ? probably)
JM
-- IMPORTANT NOTI
Ian Kelly writes:
> On Tue, Aug 25, 2015 at 9:32 AM, Skip Montanaro wrote:
>> On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen wrote:
>>>
>>> When I try it today, round brackets also work, both in 2.6.6 and
>>> 3.4.0 - no idea what version it was where they failed or if I'm
>>> imagining the who
Skip Montanaro writes:
> On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen wrote:
>
>> When I try it today, round brackets also work, both in 2.6.6 and
>> 3.4.0 - no idea what version it was where they failed or if I'm
>> imagining the whole thing.
>
> You are imagining the whole thing. Either
On Tue, Aug 25, 2015 at 9:32 AM, Skip Montanaro
wrote:
>
> On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen
> wrote:
>>
>> When I try it today, round brackets
>> also work, both in 2.6.6 and 3.4.0 - no idea what version it was where
>> they failed or if I'm imagining the whole thing.
>
>
> You
On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen <
harvested.address@is.invalid> wrote:
> When I try it today, round brackets
> also work, both in 2.6.6 and 3.4.0 - no idea what version it was where
> they failed or if I'm imagining the whole thing.
>
You are imagining the whole thing. Either
"ast" writes:
>>>> [a,b,c,d] = 1,2,3,4
>>>> a
> 1
>>>> b
> 2
>>>> c
> 3
>>>> d
> 4
>
> I have never seen this syntax before. Is it documented.
> Is there a name for that ?
I remember being unhappy when a
"Joel Goldstick" a écrit dans le message de
news:mailman.27.1440515128.11709.python-l...@python.org...
On Tue, Aug 25, 2015 at 10:32 AM, Cody Piersall wrote:
On Tue, Aug 25, 2015 at 9:16 AM, ast wrote:
The original example is one I haven't seen in the wild.
I found it using matplotl
"ast" a écrit dans le message de
news:55dc853c$0$3083$426a7...@news.free.fr...
"Joel Goldstick" a écrit dans le message de
news:mailman.23.1440513059.11709.python-l...@python.org...
On Tue, Aug 25, 2015 at 10:16 AM, ast wrote:
[a,b,c,d] = 1,2,3,4
a
1
b
2
c
"Joel Goldstick" a écrit dans le message de
news:mailman.23.1440513059.11709.python-l...@python.org...
On Tue, Aug 25, 2015 at 10:16 AM, ast wrote:
[a,b,c,d] = 1,2,3,4
a
1
b
2
c
3
d
4
I have never seen this syntax before. Is it documented.
Is there a name for t
On Tue, Aug 25, 2015 at 10:32 AM, Cody Piersall wrote:
>
>
> On Tue, Aug 25, 2015 at 9:16 AM, ast wrote:
>>>>>
>>>>> [a,b,c,d] = 1,2,3,4
>>>>> a
>>
>> 1
>>>>>
>>>>> b
>>
>> 2
>>>
- Original Message -
> From: "ast"
> To: python-list@python.org
> Sent: Tuesday, 25 August, 2015 4:16:17 PM
> Subject: [a,b,c,d] = 1,2,3,4
>
> >>> [a,b,c,d] = 1,2,3,4
> >>> a
> 1
> >>> b
> 2
> >>> c
> 3
>
On Tue, Aug 25, 2015 at 9:16 AM, ast wrote:
> [a,b,c,d] = 1,2,3,4
>>>> a
>>>>
>>> 1
>
>> b
>>>>
>>> 2
>
>> c
>>>>
>>> 3
>
>> d
>>>>
>>> 4
>
> I have never seen th
On Tue, Aug 25, 2015 at 10:16 AM, ast wrote:
>>>> [a,b,c,d] = 1,2,3,4
>>>> a
>
> 1
>>>>
>>>> b
>
> 2
>>>>
>>>> c
>
> 3
>>>>
>>>> d
>
> 4
>
> I have never seen this syn
[a,b,c,d] = 1,2,3,4
a
1
b
2
c
3
d
4
I have never seen this syntax before. Is it documented.
Is there a name for that ?
thx
--
https://mail.python.org/mailman/listinfo/python-list
x27;) name
alpha = pymc.Normal('alpha',mu=0,tau=.01)
beta = pymc.Normal('beta',mu=0,tau=.01)
@pymc.deterministic
def theta(a=alpha, b=beta):
"""theta = logit^{-1}(a+b)"""
return pymc.invlogit(a+b*x)
x is used here. Names in functions
a',mu=0,tau=.01)
@pymc.deterministic
def theta(a=alpha, b=beta):
"""theta = logit^{-1}(a+b)"""
return pymc.invlogit(a+b*x)
d = pymc.Binomial('d', n=n, p=theta, value=np.array([0.,1.,3.,5.]),\
observed=True)
I don't understand t
7, length power wrote:
> >>> x=["a","b",["c","d"],"e"]
> >>> y=x[2]
> >>> y
> ['c', 'd']
> >>> x.insert(2,y[0])
> >>> x
>
> ['a', 'b', 'c&
Boris Borcic wrote:
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its su
Rustom Mody wrote:
def fl1(l): return [y for x in l for y in x]
# recursive flatten
def fr(l):
... if not isinstance(l,list): return [l]
... return fl1([fr(x) for x in l])
For a short non-recursive procedure - not a function, modifies L in-place but
none of its sublists.
>>> def flat
On Thursday, April 10, 2014 10:55:10 AM UTC+5:30, balaji marisetti wrote:
> There was long thread discussing flattening of a list on this list :).
> See the link below.
I dont think that thread is relevant to this question:
1. That (started with) a strange/cute way of using names
2. It does not wo
There was long thread discussing flattening of a list on this list :).
See the link below.
https://mail.python.org/pipermail/python-list/2014-March/669256.html
On 10 April 2014 10:44, length power wrote:
>>>> x=["a","b",["c","d"],"e"
length power writes:
> maybe there is a more smart way to do.
Maybe. But a way to do what, exactly?
You start with a list, but what is it exactly that you want to do with
that list?
>>> x = ["a", "b", ["c", "d"], "e"]
If I in
>>> x=["a","b",["c","d"],"e"]
>>> y=x[2]
>>> y
['c', 'd']
>>> x.insert(2,y[0])
>>> x
['a', 'b', 'c', ['c', 'd'], 'e']
>&
On Sat, 24 Dec 2011 19:41:55 +0100, Thomas Rachel wrote:
>> The only times you need the brackets around a tuple is to control the
>> precedence of operations, or for an empty tuple.
>
> IBTD:
>
> a=((a, b) for a, b, c in some_iter)
> b=[(1, c) for ]
>
> Wi
On 12/24/2011 07:25 PM, Steven D'Aprano wrote:
I'd use a function attribute.
def func(x, y=None):
if y is None:
y = func.default_y
...
func.default_y = []
That's awkward only if you believe function attributes are awkward.
I do. All you've done is move the default from *before* the
On Dec 25, 5:32 am, Devin Jeanpierre wrote:
> alex23 wrote:
> > Because I believe that the source of confusion has far more to do with
> > mutable/immutable objects than with early/late binding. Masking or
> > 'correcting' an aspect of Python's behaviour because novices make the
> > wrong assumpti
> Because I believe that the source of confusion has far more to do with
> mutable/immutable objects than with early/late binding. Masking or
> 'correcting' an aspect of Python's behaviour because novices make the
> wrong assumption about it just pushes the problem elsewhere and
> potentially makes
On Dec 25, 9:25 am, Devin Jeanpierre wrote:
> > If Python was ever 'fixed' to prevent this issue, I'm pretty sure we'd
> > see an increase in the number of questions like the OP's.
>
> What makes you so sure? Both models do make sense and are equally
> valid, it's just that only one of them is tru
1 - 100 of 563 matches
Mail list logo