On May 9, 2:31 am, Trent Nelson wrote:
> > What are your favorites?
>
> I think I've posted this before, but I love my
> 3-lines-if-you-ignore-the-scaffolding language translator. Not because it's
> clever code -- quite the opposite, the code is dead simple -- but because it
> encompasses one
> What are your favorites?
I think I've posted this before, but I love my
3-lines-if-you-ignore-the-scaffolding language translator. Not because it's
clever code -- quite the opposite, the code is dead simple -- but because it
encompasses one of the things I love about Python the most: it gets
On May 7, 1:29 am, Steven D'Aprano wrote:
> On Fri, 06 May 2011 12:36:09 -0600, Ian Kelly wrote:
> > The amb engine would conceptually execute this function for every
> > possible combination of a, b, and c,
>
> Which pretty much is the definition of "brute-force solver", no?
FWIW, here's one of
On Sat, May 7, 2011 at 2:29 AM, Steven D'Aprano
wrote:
>> This isn't really amb; as you said it's just a brute-force solver with
>> some weird syntax. The whole point of amb is to enable
>> non-deterministic programming, such as this:
> [...]
>> The amb engine would conceptually execute this func
On Fri, 06 May 2011 12:36:09 -0600, Ian Kelly wrote:
> On Fri, May 6, 2011 at 10:59 AM, Steven D'Aprano
> wrote:
>> As written, amb is just a brute-force solver using more magic than is
>> good for any code, but it's fun to play with.
>
> This isn't really amb; as you said it's just a brute-forc
[Steven D'Aprano]:
> As written, amb is just a brute-force solver using more magic than is
> good for any code, but it's fun to play with.
With a small change in API, much of the magic isn't needed.
from itertools import product
def amb(func, *argument_ranges):
for args in product(*argument_
On Fri, May 6, 2011 at 12:36 PM, Ian Kelly wrote:
> This is typically implemented using continuations, and I'm not sure
> whether a true amb could actually be achieved in Python without adding
> continuations or flow-control macros to the language.
I stand corrected. After poking around a bit mo
On Fri, May 6, 2011 at 10:59 AM, Steven D'Aprano
wrote:
> As written, amb is just a brute-force solver using more magic than is
> good for any code, but it's fun to play with.
This isn't really amb; as you said it's just a brute-force solver with
some weird syntax. The whole point of amb is to e
On Fri, May 6, 2011 at 9:59 AM, Steven D'Aprano
wrote:
> On Mon, 02 May 2011 10:33:31 -0700, Raymond Hettinger wrote:
>
>> I think it is time to give some visibility to some of the instructive
>> and very cool recipes in ActiveState's python cookbook.
> [...]
>> What are your favorites?
>
>
> I'm
On Mon, 02 May 2011 10:33:31 -0700, Raymond Hettinger wrote:
> I think it is time to give some visibility to some of the instructive
> and very cool recipes in ActiveState's python cookbook.
[...]
> What are your favorites?
I'm not sure if favourite is the right word, but I'm amazed by this one:
On Tuesday 03 May 2011 16:00:05 Terry Reedy wrote:
> On 5/3/2011 1:04 AM, Stefan Behnel wrote:
> > The bad thing about this recipe is that it requires quite a
> > bit of background knowledge in order to infer that the
> > code the developer is looking at is actually correct.
>
> The main math know
On May 2, 11:23 pm, Stefan Behnel wrote:
> Terry Reedy, 03.05.2011 08:00:
>
> > On 5/3/2011 1:04 AM, Stefan Behnel wrote:
>
> >> The bad thing about this recipe is that it requires quite a bit of
> >> background knowledge in order to infer that the code the developer is
> >> looking at is actually
On Tue, May 3, 2011 at 3:54 PM, Chris Angelico wrote:
> On Wed, May 4, 2011 at 2:43 AM, Raymond Hettinger wrote:
>> We should have a separate thread for the most practical, best
>> documented, least surprising, and most boring recipe ;-)
>
> a += b # Adds b to a in-place. Polymorphic - works on
On Wed, May 4, 2011 at 2:43 AM, Raymond Hettinger wrote:
> We should have a separate thread for the most practical, best
> documented, least surprising, and most boring recipe ;-)
a += b # Adds b to a in-place. Polymorphic - works on a wide variety of types.
You didn't say it had to be complic
On Tue, May 3, 2011 at 8:49 AM, Terry Reedy wrote:
> On 5/3/2011 2:29 AM, Gregory Ewing wrote:
>>
>> Terry Reedy wrote:
>>>
>>> The trick is that replacing x with j and evaluating therefore causes
>>> (in Python) all the coefficients of x (now j) to be added together
>>> separately from all the co
On May 2, 10:04 pm, Stefan Behnel wrote:
> The bad thing about this recipe is that it requires quite a bit of
> background knowledge in order to infer that the code the developer is
> looking at is actually correct. At first sight, it looks like an evil hack,
> and the lack of documentation doesn'
On May 2, 11:29 pm, Gregory Ewing wrote:
> Terry Reedy wrote:
> > The trick is that replacing x with j and evaluating
> > therefore causes (in Python) all the coefficients of x (now j) to be
> > added together separately from all the constant terms to reduce the
> > linear equation to a*x+b (= 0 i
On 5/3/2011 2:29 AM, Gregory Ewing wrote:
Terry Reedy wrote:
The trick is that replacing x with j and evaluating therefore causes
(in Python) all the coefficients of x (now j) to be added together
separately from all the constant terms to reduce the linear equation
to a*x+b (= 0 implied).
Hmmm
Terry Reedy wrote:
The trick is that replacing x with j and evaluating
therefore causes (in Python) all the coefficients of x (now j) to be
added together separately from all the constant terms to reduce the
linear equation to a*x+b (= 0 implied).
Hmmm... so if we used quaternions, could we s
Terry Reedy, 03.05.2011 08:00:
On 5/3/2011 1:04 AM, Stefan Behnel wrote:
The bad thing about this recipe is that it requires quite a bit of
background knowledge in order to infer that the code the developer is
looking at is actually correct.
The main math knowledge needed is the trivial fact
On 5/3/2011 1:04 AM, Stefan Behnel wrote:
The bad thing about this recipe is that it requires quite a bit of
background knowledge in order to infer that the code the developer is
looking at is actually correct.
The main math knowledge needed is the trivial fact that if a*x + b = 0,
then x = -
On Mon, May 2, 2011 at 11:04 PM, Stefan Behnel wrote:
> The bad thing about this recipe is that it requires quite a bit of
> background knowledge in order to infer that the code the developer is
> looking at is actually correct. At first sight, it looks like an evil hack,
> and the lack of documen
David Monaghan, 02.05.2011 23:45:
On Mon, 2 May 2011 14:58:50 -0600, Ian Kelly wrote:
On Mon, May 2, 2011 at 2:48 PM, David Monaghan wrote:
On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger wrote:
I think it is time to give some visibility to some of the instructive
and very cool re
On Mon, 2 May 2011 14:58:50 -0600, Ian Kelly wrote:
>On Mon, May 2, 2011 at 2:48 PM, David Monaghan
> wrote:
>> On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger
>> wrote:
>>
>>>I think it is time to give some visibility to some of the instructive
>>>and very cool recipes in ActiveState
On Mon, May 2, 2011 at 2:48 PM, David Monaghan
wrote:
> On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger
> wrote:
>
>>I think it is time to give some visibility to some of the instructive
>>and very cool recipes in ActiveState's python cookbook.
>>
>>My vote for the coolest recipe of al
On Mon, 2 May 2011 10:33:31 -0700 (PDT), Raymond Hettinger
wrote:
>I think it is time to give some visibility to some of the instructive
>and very cool recipes in ActiveState's python cookbook.
>
>My vote for the coolest recipe of all time is:
>
>
> http://code.activestate.com/recipes/365013-
I think it is time to give some visibility to some of the instructive
and very cool recipes in ActiveState's python cookbook.
My vote for the coolest recipe of all time is:
http://code.activestate.com/recipes/365013-linear-equations-solver-in-3-lines/
What are your favorites?
Raymond
twit
27 matches
Mail list logo