Jim Segrave wrote:
> In article <[EMAIL PROTECTED]>,
> Scott David Daniels <[EMAIL PROTECTED]> wrote:
>> class FileReIterable2(object):
>> ...
>> def __iter__(self):
>> self.file.seek(0)
>> for line in self.file:
>> nextpos = self.file.te
In article <[EMAIL PROTECTED]>,
Scott David Daniels <[EMAIL PROTECTED]> wrote:
>
>This works if-and-only-if it is only in use once at a time.
>If you have multiple simultaneous accesses, you need to do
>something like:
>
> class FileReIterable2(object):
> def __init__(self, file):
>
Scott David Daniels wrote:
> [EMAIL PROTECTED] wrote:
> > Scott David Daniels wrote:
> >> Sorry, "re-iterables". A file re-iterable is:
> >>
> >> class FileReIterable(object): ...
> >> def __iter__(self):
> >> self.file.seek(0)
> >> return iter(self.file)
>
[EMAIL PROTECTED] wrote:
> Scott David Daniels wrote:
>> Sorry, "re-iterables". A file re-iterable is:
>>
>> class FileReIterable(object): ...
>> def __iter__(self):
>> self.file.seek(0)
>> return iter(self.file)
>>
>> This works if-and-only-if it is only in
Scott David Daniels wrote:
> Sorry, "re-iterables". A file re-iterable is:
>
> class FileReIterable(object):
> def __init__(self, file):
> if isinstance(file, basestring):
> self.file = open(file, 'rU')
> else:
> self.file
[EMAIL PROTECTED] wrote:
> Scott David Daniels wrote:
>
>> This works with "iterables" (and produces), rather than "iterators",
>> which is vital to the operation.
>>
>> --Scott David Daniels
>> [EMAIL PROTECTED]
>
> Sorry, it doesn't. It works with strings. It doesn't work with file,
> it does
Scott David Daniels wrote:
> This works with "iterables" (and produces), rather than "iterators",
> which is vital to the operation.
>
> --Scott David Daniels
> [EMAIL PROTECTED]
Sorry, it doesn't. It works with strings. It doesn't work with file,
it doesn't work with iterators I have created.
This would only work for combinations of identical sets, and also does
not seem to work with generated sets, or iterators. Forgetting dice
for a moment. Say I have 3 very long files, and i want to generate the
combinations of lines in the files. This provides a well known
iterator for the exampl
[EMAIL PROTECTED] wrote:
> However, none of the algo's I have checked will work with generated
> sequences, or iterable classes, as posited in my first post.
>
> While appropriate to the current domain, ie dice. What if you want
> combinations of extrememely large lists, say 3 sets of 10 mil item
[EMAIL PROTECTED] wrote:
>
>
> Well thanks for the mathematical restatement of my problem. I had
> forgotten the proper terms. Searching on those terms generates some
> interesting results.
>
> However, none of the algo's I have checked will work with generated
> sequences, or iterable classe
Well thanks for the mathematical restatement of my problem. I had
forgotten the proper terms. Searching on those terms generates some
interesting results.
However, none of the algo's I have checked will work with generated
sequences, or iterable classes, as posited in my first post.
While app
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Terry Reedy wrote:
>
>>
>> Are the dice identical or distinguishable (marked). In other words,
>> with 2
>> dice, is 1,2 the same as 2,1 or different? Note that in most dice
>> games,
>> such as craps, the dice are not distinguis
hmmm, just needed better search words, thanks :)
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
>
> Are the dice identical or distinguishable (marked). In other words, with 2
> dice, is 1,2 the same as 2,1 or different? Note that in most dice games,
> such as craps, the dice are not distinguished, but probability calculations
> must treast them as if they were to get th
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok, this is really irritating me. I'm sure there are different ways of
> doing this - I'm interested in the algo, not the practical solution,
> I'm more trying to play with iterators and recursion. I want to create
> a program that g
[EMAIL PROTECTED] wrote:
> Ok, this is really irritating me. I'm sure there are different ways of
> doing this - I'm interested in the algo, not the practical solution,
> I'm more trying to play with iterators and recursion. I want to create
> a program that generates every possible combination
Ok, this is really irritating me. I'm sure there are different ways of
doing this - I'm interested in the algo, not the practical solution,
I'm more trying to play with iterators and recursion. I want to create
a program that generates every possible combination of a set of a n
dice, with s sides
17 matches
Mail list logo