On Monday, January 26, 2015 at 12:52:04 PM UTC+5:30, Jussi Piitulainen wrote:
> Rustom Mody writes:
>
> > To add to Ian:
> >
> > The classic way of doing it in a functional framework is called:
> > "Replace failure by list of successes"
> >
> > https://rkrishnan.org/files/wadler-1985.pdf
> >
>
Rustom Mody writes:
> To add to Ian:
>
> The classic way of doing it in a functional framework is called:
> "Replace failure by list of successes"
>
> https://rkrishnan.org/files/wadler-1985.pdf
>
> The things that have to go into it are
> 1. Extensive use of list comprehensions
> 2. Lazy lists
Israel Brewster writes:
> ...
> Running it through GDB didn't seem to give me much more information than that
> crash report - I can see that it is in thread 0, and the call stack is
> identical to what the crash report shows, but I can't see where in the python
> code it is.
> ...
> Thread 0 C
Yawar Amin wrote:
> Hi Steven,
>
> On Saturday, January 24, 2015 at 11:27:33 PM UTC-5, Steven D'Aprano
> wrote:
>> [...]
>> > Doesn't the traceback tell us exactly where the lambda was called
>> > from?
>>
>> Yes (assuming the source code is available, which it may not be), but
>
> If the sourc
On Monday, January 26, 2015 at 2:21:34 AM UTC+5:30, Ian Foote wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> I think a very idiomatic way to implement backtracking is using a
> recursive generator (python 3):
>
> def backtrack_solver(data=None):
> if data is None:
>
On Jan 25, 2015 2:37 PM, "Terry Reedy" wrote:
> 2. the second array is a compact array of entries in insertion order,
such as
>
> [hash, ptr to 'x', ptr to 23]
> [hash, ptr to 'colour', ptr to 'red']
> [hash, ptr to the string 'y', ptr to the int 42]
>
> Iteration would use the compact
On Mon, Jan 26, 2015 at 12:31 PM, Marko Rauhamaa wrote:
> Backtracking means the part of depth-first traversal where you retreat
> to the parent node. If you implement your traversal with a recursive
> function, backtracking means — more or less — a return from the
> function.
But possibly you ne
Ben Finney :
> “Back-tracking” doesn't have a general meaning I recognise beyond
> random access into a data structure.
Backtracking means the part of depth-first traversal where you retreat
to the parent node. If you implement your traversal with a recursive
function, backtracking means — more o
Hi Steven,
On Saturday, January 24, 2015 at 11:27:33 PM UTC-5, Steven D'Aprano
wrote:
> [...]
> > Doesn't the traceback tell us exactly where the lambda was called
> > from?
>
> Yes (assuming the source code is available, which it may not be), but
If the source code is not available, then you're
On 2015-01-26 00:32, Ben Finney wrote:
Johannes Bauer writes:
So, I would like to ask if you have a Pythonic approach to
backtracking problems? If so, I'd love to hear your solutions!
I'm not aware of what the problem is. “Back-tracking” doesn't have a
general meaning I recognise beyond rand
Johannes Bauer writes:
> So, I would like to ask if you have a Pythonic approach to
> backtracking problems? If so, I'd love to hear your solutions!
I'm not aware of what the problem is. “Back-tracking” doesn't have a
general meaning I recognise beyond random access into a data structure.
So a P
On 1/25/2015 7:00 AM, Steven D'Aprano wrote:
What happens inside the dictionary? Dictionaries are "hash tables", so they
are basically a big array of cells, and each cell is a pair of pointers,
one for the key and one for the value:
[dictionary header]
[blank]
[blank]
[ptr t
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I think a very idiomatic way to implement backtracking is using a
recursive generator (python 3):
def backtrack_solver(data=None):
if data is None:
yield from backtrack_solver(data=initial_data)
if cannot_be_valid(data):
Hello Everyone,
I am trying to read(open) and write files in hdfs inside a python script. But
having error. Can someone tell me what is wrong here.
Code (full): sample.py
#!/usr/bin/python
from subprocess import Popen, PIPE
print "Before Loop"
cat = Popen(["h
Hi folks,
I have a problem at hand that needs code for backtracking as a solution.
And I have no problem coding it, but I can't get rid of the feeling that
I'm always solving backtracking problems in a non-Pythonic
(non-idiomatic) way. So, I would like to ask if you have a Pythonic
approach to bac
In article ,
pyt...@mrabarnett.plus.com says...
> In the REPL, the result of an expression is bound to '_':
>
> >>> x1 = A(12)
> >>> x1 # _ will be bound to the result.
> 12
> >>> x1 = 'string'
> >>> # At this point, _ is still bound to the object.
> >>> 0 # This will bind _ to another objec
__del__ is unreliable. But don't take my word, check out the doc.
https://docs.python.org/3.2/reference/datamodel.html#object.__del__
--
https://mail.python.org/mailman/listinfo/python-list
On 2015-01-25 18:23, Mario Figueiredo wrote:
Consider the following class:
class A:
def __init__(self, value):
self.value = value
def __del__(self):
print("'A' instance being collected...")
def __repr__(self):
return str(se
In article , mar...@gmail.com
says...
> [...]
Forgot to mention this is Python 3.4.2
--
https://mail.python.org/mailman/listinfo/python-list
Consider the following class:
class A:
def __init__(self, value):
self.value = value
def __del__(self):
print("'A' instance being collected...")
def __repr__(self):
return str(self.value)
If ran as a script, the destructor behavior
On 25/01/2015 02:11, Dan Stromberg wrote:
Hi folks.
I've been benchmarking some python modules that are mostly variations
on the same theme.
For simplicity, let's say I've been running the suite of performance
tests within a single interpreter - so I test one module thoroughly,
then move on to
On Sun, 25 Jan 2015 13:24:40 +0100, Peter Otten wrote:
> Dan Stromberg wrote:
>
>> I've been benchmarking some python modules that are mostly variations
>> on the same theme.
>>
>> For simplicity, let's say I've been running the suite of performance
>> tests within a single interpreter - so I te
Mario Figueiredo :
> Knowing Python internals is something that will end benefiting me in
> the long run. There's much to be gained by knowing the inner working
> of your programming language...
>
> Python is missing an under-the-hood book, I suppose. Tracing through
> Python source code to learn
In article <54c4dae1$0$13005$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
> [...]
Most excellent. Thanks for the hard work, explaining this to me. :)
Knowing Python internals is something that will end benefiting me in the
long run. There's much to be gained
Dan Stromberg wrote:
> I've been benchmarking some python modules that are mostly variations
> on the same theme.
>
> For simplicity, let's say I've been running the suite of performance
> tests within a single interpreter - so I test one module thoroughly,
> then move on to the next without exit
Mario Figueiredo wrote:
> In article <54c4606a$0$13002$c3e8da3$54964...@news.astraweb.com>,
> steve+comp.lang.pyt...@pearwood.info says...
>>
>> It doesn't.
>
> Your explanation was great Steven. Thank you. But raises one question...
>
>>
>> Assigning a value to a variable ("m = 42", hex 2A) r
In article <54c4606a$0$13002$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@pearwood.info says...
>
> It doesn't.
Your explanation was great Steven. Thank you. But raises one question...
>
> Assigning a value to a variable ("m = 42", hex 2A) results in the compiler
> storing that
Dan Stromberg :
> BTW, there isn't much else going on on this computer, except some
> possible small cronjobs.
The OS caches the files in RAM. You'd expect the file I/O performance to
get much better on test reruns. On the other hand, OS cache flushing
happens at random times, which affects the r
On 25/01/2015 01:55, Terry Reedy wrote:
'This situation' being that Someclass.attro works but Someclass().attro
raises...
In other words, if 'Someclass.attro' evaluates to an object ...
then 'Someclass().attro' *normally* evaluates to the same object
I am sorry Terry, but I do not agree, beca
On Sun, Jan 25, 2015 at 6:49 PM, Brian Gladman wrote:
> Thanks, a part of this was a wish to understand how to map what I can do
> in other languages into Python. I felt that it might just be possible
> in Python to avoid having to wrap all the methods of the base class in
> the derived class. B
30 matches
Mail list logo