Alex Martelli wrote:
> Modern equivalent of serialization (publishing one chapter at a time on
> the web, the next chapter to come only if the author receives enough
> payment for the previous one) have been attempted, but without much
> success so far; however, the holy grail of "micropayments" m
Bengt Richter wrote:
> On Thu, 17 Nov 2005 10:53:24 -0800, [EMAIL PROTECTED] (Alex Martelli) wrote:
>
> >Anton Vredegoor <[EMAIL PROTECTED]> wrote:
> [...]
> >> The idea of using a webservice to hide essential secret parts of your
> >> application can
Alex Martelli wrote:
> Money is made in many ways, essentially by creating (perceived) buyer
> advantage and capturing some part of it -- but market segmentation is
> just one of many ways. IF your predictions are ENORMOUSLY better than
> those the competition can make, then offering for free "s
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>...
> > Suppose I grant all your theories about optimal marketing strategies.
I wish I hadn't done that :-) But seriously, I'm having trouble
answering in detail all of your points (which doe
Christoph Zwerschke wrote:
> But of course, it will always be slower since it is constructed on top
> of the built-in dict. In end effect, you always have to maintain a
> sequence *plus* a dictionary, which will be always slower than a sheer
> dictionary. The ordered dictionary class just hides th
I'm trying to post messages to the jython mailing list via gmane. I
this possible? I've got all kinds of messages confirming that I exist
and that my message has arrived and will be either approved or rejected
with an explanation, but since then nothing but silence and my message
doesn't show up e
Thomas Heller wrote:
> The easiest solution for this is to join the mailing list (with the
> email address that you use to post), disable list delivery, and repost
> your message via gmane.
>
Thanks.
Anton
--
http://mail.python.org/mailman/listinfo/python-list
This is about how to start a Python interpreter on a very locked down
library computer.
Some time ago I started a thread about it.(Google won't let me reply to
older topics so I'm starting a new topic with the same title) A few
days ago I found a Jython console applet that can be run from a
webpa
John Machin wrote:
> You don't need to use random sampling. Paul Rubin has shown how it can
> be done deterministically. The following is a generalisation of his
> code; it generates all possible assemblies of size n from a list of
> parts. Is this helpful?
>
> def all_size_n_knickers(rqd_size, pi
Steve Holden wrote:
> > This makes me wonder why we still don't have something like the unint
> > function above in the standard distribution.
> >
> Because it's not what you'd call (or, at least, it's not what I'd call)
> universally required. As you have shown it is relatively easy to hack
> som
Diez B. Roggisch wrote:
> As everyone posts his, I'll do the same :) It uses some constraint based
> solving techniques - but not too complicated ones. When stuck, it
> backtracks. So far it never failed me, but I haven't tested it too
> thouroughly.
Thanks to all for sharing. I like to program su
Steven D'Aprano wrote:
> On Fri, 09 Dec 2005 16:03:46 +1100, Ben Finney wrote:
>
> >> Do you want the result to be:
> >> AB, AC, AD, BC, BD, CD
> >
> > That is the complete set of combinations of the letters.
> >
> >> Or, do you want AB,BA,AC,CA,AD,DA,BC,CB,BD,DB,CD,DB ?
> >
> > That is the comple
Michael wrote:
> Ilias Lazaridis wrote:
> > [ panic, fear, worry ]
>
> What's wrong with just saying "Congratulations!" ? First thing I thought was
> "ooh, maybe Guido will be able to work on P3K there" - after all that would
> benefit Google *and* everyone else :-)
Google's not a nice company (
Robert Kern wrote:
> I have a friend who works at Google. He has no backstabbing history at all.
> Stop
> insulting my friends.
Your friends work for people who would never hire me. My resume sucks,
but I'm not a bad person or a mediocre programmer. They sold out.
> For Software Engineer:
>
> "
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>...
> > Google's not a nice company (yeah, I know I'm posting from a google
> > account). If you look at their job requirements it's clear they will
> > only hire people with long
Michael Sparks wrote:
> Sorry to reply to the thread so late in the day, but I noticed (via
> QOTW :-( ) that Anton got worked up at me suggesting that congratulating
> someone with a new job was a nice idea (surprised me too - all the
> Google employees I've met have been very nice people), read
DaveM wrote:
> On 3 Jan 2006 20:09:34 -0800, [EMAIL PROTECTED] (Aahz) wrote:
>
> >Unfortunately, this isn't quite true. Medicine and law both require the
> >passing of an apprenticeship, so there's still some room for favoritism
> >and blackballing.
>
> In the UK, in Medicine, House Officer jobs
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>
>> However I still maintain that I was never able to meet these fine
>> people you speak about and which you seem to know because the cost
>> involved (a few hundred euro to visit pycon for exampl
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>
> > However I still maintain that I was never able to meet these fine
> > people you speak about and which you seem to know because the cost
> > involved (a few hundred euro to visit pycon for exam
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>
> > However I still maintain that I was never able to meet these fine
> > people you speak about and which you seem to know because the cost
> > involved (a few hundred euro to visit pycon for exam
Alex Martelli wrote:
> I just don't understand, always assuming you're in the Netherlands, how
> attending Europython in Belgium (as opposed to Pycon in the US) could
> have cost hundreds of euros. Conference registration is free to
> speakers, bicycling NL->BE not costly (many were driving from
Armin Rigo wrote:
> We have some procedure now for funding
> travel costs, although it's admittedly very bureaucratic :-(
Since next sprint is in Palma de Mallorca I trust I can count on PyPy
to refund me the money?
> Anyway, independently of this, there are some people we are happy to see
> co
Alex Martelli wrote:
> situations, and in a few cases been able to help them back up. People
> who attempt to *guilt-trip* me into helping have never been and will
> never been in that lot: in this way, I'm definitely not a typical, guilt
> driven "bleeding heart". I try to help people who are t
Alex Martelli wrote:
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>...
> > You are not my superior (or even considered to be more succesfull) as
> > you seem to imply.
>
> Depends on who does the considering, I'm sure. If the considerer loves
> the Eng
Steve Holden wrote:
> Consider yourself excused.
Thanks.
Anton
--
http://mail.python.org/mailman/listinfo/python-list
ago wrote:
> You can see my amended code in the link above.
Thanks, I will look into it sometime. At the moment I'm at a library
computer, which severely limits my Python options. Meanwhile I have
been thinking about the sudoku problem, maybe it will prompt you, me or
someone else to make some ki
Paul Rubin wrote:
> For an absolutely amazing translation feat, try Michael Kandel's
> Polish-to-English translation of Stanislaw Lem's "The Cyberiad".
Returning to the original book, why did they write a lot of it (at
least the first few pages until I gave up, after having trouble
understanding
Juho Schultz wrote:
> Last month I spent about an hour trying to explain why
> a*2.5e-8 = x
> raises a SyntaxError and why it should be written
> x = a*2.5e-8
> The guy who wrote the 1st line has MSc in Physics from Cambridge (UK).
> In mathematics, there is no difference between the two lines.
S
ago wrote:
> Do you think it is possible to reduce the set of all possible solutions
> to a small enough set? I personally doubt it, but IF that was the case
> an efficient solver could be easily created.
No I don't think so, but it's a great idea :-) . Iff we would have some
ultimate symmetry de
Terry Hancock wrote:
> On 19 Jan 2006 13:57:06 +0100
> Anton Vredegoor <[EMAIL PROTECTED]> wrote:
> > Some time ago I tried to 'sell' Python to a mathematician.
> > The crucial point was that it was not (in standard Python)
> > possible to have a
ago wrote:
[Something I mostly agree with]
> According to Anton the number of possible solutions can be reduced
> using 1) number swapping, 2) mirroring, 3) blocks/rows/columns
> swapping. All those operations create equivalent matrices. For a 9X9
> grid, this should give a reduction factor = (9
Paul Rubin wrote:
> The first few pages are a review of probability theory but I think
> they assume you've seen it before. The book's subject matter is more
> mathematical by nature than what most programmers deal with from day
> to day, and as such, the book is not for everyone.
And so the cyc
Paul Rubin wrote:
> signal processing, for example. Perhaps it could be improved by being
> more explicit about what the reader needs to know, and giving
> references to other books where the prerequisites can be found.
There are lots of good explanations, graphs, diagrams and such things
in the
[EMAIL PROTECTED] wrote:
> does anyone know a module or something to convert numbers like integer
> to binary format ?
>
> for example I want to convert number 7 to 0111 so I can make some
> bitwise operations...
>>> def bits(i,n):
return tuple((0,1)[i>>j & 1] for j in xrange(n-1,-1,-
Alex Martelli wrote:
[snip]
Can somebody please shut down this bot? I think it's running out of
control. It seems to be unable to understand that "don't be evil" might
be good when you're small (at least it's not very bad) but that it
becomes distinctly evil when you're big.
What is good when
Alex Martelli wrote:
> <[EMAIL PROTECTED]> wrote:
>> Can somebody please shut down this bot? I think it's running out of
>
> Much as you might love for somebody to "shut me down", that
> (unfortunately, no doubt, from your viewpoint) is quite unlikely to
> happen. Although "making predictions
With the inclusion of ElementTree (an XML-parser) in Python25 and recent
developments concerning JSON (a very Pythonesque but somewhat limited
XML notation scheme, let's call it statically typed XML) Python seems to
have reached a stage where it now seems to be possible to completely
swallow le
bruno at modulix wrote:
> I still don't get the point.
Well, I've got to be careful here, lest I'd be associated with the
terr.., eh, the childp..., eh the macro-enablers.
The idea is to have a way to transform a Python (.py) module into XML
and then do source code manipulations in XML-space u
Diez B. Roggisch wrote:
<...>
>> The whole point of a code transformation mechanism like the one Anton is
>> talking about is to be dynamic. Else one just needs a preprocessor...
>
> No, it is not the whole point. The point is
>
> ""
> The idea is that we now have a fast parser (ElementTree) w
Bruno Desthuilliers wrote:
> You mean like 'converting' javascript to python or python to ruby (or
> converting any home-grown DSL to Python, etc) ?
Yes, but also what some other posters mentioned, making Pythons internal
parsing tree available to other programs (and to Python itself) by using
Girish Sahani wrote:
> I want to generate all permutations of a string. I've managed to
> generate all cyclic permutations. Please help :)
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496724
anton
--
http://mail.python.org/mailman/listinfo/python-list
Paul Boddie wrote:
> Anton Vredegoor wrote:
>> Yes, but also what some other posters mentioned, making Pythons internal
>> parsing tree available to other programs (and to Python itself) by using
>> a widely used standard like XML as its datatype.
>
> http://pysch.sou
For the last few days I've been doodling with a script that provides a
graphical interface to gnugo by using its GTP protocol. At the moment
the script is *very* basic, in fact the only thing it does is to allow
one to click on a coordinate and place a move there OR press the space
bar in order
Jim wrote:
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###
> def a():
> m()
> return None
>
>
> file main.py:
> #
> from abc import *
> def m():
> pri
grindel wrote:
> Anton Vredegoor wrote:
[...]
>> Here's the proof of concept, just copy it to some dir and run the
>> Python script:
>>
>> http://home.hccnet.nl/a.vredegoor/gnugo/
>>
>> It needs Python 2.5 which you can get at:
>>
>> htt
Gerard Flanagan wrote:
> No claims with respect to speed, but the kslice function here:
>
> http://gflanagan.net/site/python/utils/sequtils/
>
> will give the 'k-subsets' which then need to be permuted -
> alternatively Google.
Maybe the function below could then do these permutations.
Ant
Paul Rubin wrote:
> def deals():
> for i in xrange(13**5):
> cards = [(i//p) % 13 for p in (1, 13, 169, 2197, 28561)]
> yield cards
This gives hands like [0,0,0,0,1] and [0,0,0,1,0] which are
permutations of one another.
Below is a piece of code that avoids th
Paul McGuire wrote:
> I just published my first article on ONLamp, a beginner's walkthrough for
> pyparsing.
>
> Please check it out at
> http://www.onlamp.com/pub/a/python/2006/01/26/pyparsing.html, and be sure to
> post any questions or comments.
I like your article and pyparsing. But since you
Paul Rubin wrote:
> Cool, I'd still like to know why (13**5)-13 = C(52,5) other than
> by just doing the arithmetic and comparing the results. Maybe your
> tkinter script can show that.
That seems to be very hard :-) Unless I'm missing something.
Anton
def noverk(n,k):
return reduce(lambda
Anton Vredegoor wrote:
> Paul Rubin wrote:
>
> > Cool, I'd still like to know why (13**5)-13 = C(52,5) other than
> > by just doing the arithmetic and comparing the results. Maybe your
> > tkinter script can show that.
>
> That seems to be very hard :-) Un
Paul McGuire wrote:
> There are two types of parsers: design-driven and data-driven. With
> design-driven parsing, you start with a BNF that defines your language or
> data format, and then construct the corresponding grammar parser. As the
> design evolves and expands (new features, keywords, a
Michael Spencer wrote:
> This returns an iterator that 'nests' an arbitrary number of sequences
> (odometer-style).
>
> def nest(*sequences):
> def _nest(outer, inner):
> for outer_item in outer:
> if not isinstance(outer_item, tuple):
> outer_item = (o
John J. Lee wrote:
> Why not Jython?
There's no command prompt! The file menu from IE is also gone. There is
a sun Java console but it looks like this:
Java(TM) Plug-in: Version 1.4.2_06
Using JRE version 1.4.2_06 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\x
John J. Lee wrote:
> Why not Jython?
There's no command prompt! The file menu from IE is also gone. There is
a sun Java console but it looks like this:
Java(TM) Plug-in: Version 1.4.2_06
Using JRE version 1.4.2_06 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\x
Timothy Smith wrote:
> how locked down is the computer? there's a few (brave) public access
> unix shell providers out there. if you could run telnet you could use
them
Sorry, no telnet. Every executable that is not listed is blocked. For
example I can download:
http://prdownloads.sourceforge.ne
Robert Kern wrote:
> There is a Java SSH client that runs in the browser.
>
> http://www.oit.duke.edu/sa/security/ssh.html
Great! I have a terminal. I can't figure out how to start jython from
there though.
Anton
--
http://mail.python.org/mailman/listinfo/python-list
Chris Lambacher topposted:
> usb key and moveable python.
> http://www.voidspace.org.uk/python/movpy/
I have a usb card reader and I can use it. That saves me from having to
have remote storage at least. However I can only save files, not open
them, except if I use word, excel or powerpoint.
The
Christos TZOTZIOY Georgiou wrote:
> I am not sure I will help you (uncertainty based on the part I
snipped),
> but the part so far can be easilly solved if you install Python for
> single user inside the "Documents and settings\" folder (or
> whatever it is called). I did in a similar case.
.msi
Mike Meyer wrote:
> > Sorry, no telnet. Every executable that is not listed is blocked.
>
> You sure? IE used to understand telnet: URLs, and would open a
console
> window talking to the remote end. It may have been doing it with an
> external application, in which case this won't help you.
Yes,
alex23 wrote:
> You know, there _are_ valid reasons for libraries et.al. 'locking
down'
> public terminals other than fascism...
Maybe, but in this case I can run only IE, word, excel and powerpoint.
Do you think there is a rational reason for that? Like Tim Peters
showing up, explaining that it
alex23 wrote:
> In this case, it sounds like the library is providing computers for
two
> purposes: access to Office tools and to the internet. Given the
> "everything not forbidden is permissable" attitude of most people,
> unless the use is restricted to only those two activities people
> legiti
Carl Friedrich Bolz wrote:
> Rumors have it that the secret goal is being faster-than-C which is
> nonsense, isn't it?
Maybe not. If one can call functions from a system dll (a la ctypes,
some other poster already mentioned there was some investigation in
this area) one can skip a layer of the hi
Kay Schluehr wrote:
> Anton Vredegoor wrote:
>
> > I'm not involved in PyPy myself but this would seem a logical
> > possibility. To go a step further, if the compiler somehow would know
> > about the shortest machine code sequence which would produce the
> > de
I found this on the web:
http://www.setgame.com/set/puzzle_frame.htm
and I'm currently trying to develop a script that models this space and
that gives a nice graphic display. Also developing a solver for this or
larger spaces looks interesting. I'm not asking for assistance, it just
looks like s
Alex Martelli wrote:
> You can find a few examples of me demonstrating the subject of your
> interest by searching for my name e.g. on video.google.com; searching
> for my name on Amazon will show some books using similar techniques, and
> searching for my name on groups.google.com will find about
[EMAIL PROTECTED] wrote:
> Given a list of elements that are either a character or a character
> follows by a number, e.g.
>
> ['a', 'b', 'c1', 'd', 'e1', 'f', 'c2', 'x', 'e2']
>
> find all the permutations that are given by switching the positions of
> the elements that:
> (1) begins with the
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> i have a c function from some modbus documentation that i need to
> translate into python.
>
> it looks like this:
>
>
> unsigned short CRC16(puchMsg, usDataLen)
> unsigned char *puchMsg ;
> unsigned short usDataLen ;
> {
>unsigne
[EMAIL PROTECTED] wrote:
> Try it with
>
> def test():
> L = 'a', 1, 2, 'a'
> it1, it2 = xsplitter(L, lambda x: x == 'a')
> print it1.next()
> print it2.next()
> print it1.next()
> print it2.next()
>
>
> The last print statement raises StopIteration...
> We, however, exp
Anton Vredegoor wrote:
> [EMAIL PROTECTED] wrote:
>
>> Try it with
>>
>> def test():
>> L = 'a', 1, 2, 'a'
>> it1, it2 = xsplitter(L, lambda x: x == 'a')
>> print it1.next()
>> print it2.next()
>
Anton Vredegoor wrote:
> Anton Vredegoor wrote:
>> [EMAIL PROTECTED] wrote:
>>
>>> Try it with
>>>
>>> def test():
>>> L = 'a', 1, 2, 'a'
>>> it1, it2 = xsplitter(L, lambda x: x == 'a')
>>
[EMAIL PROTECTED] wrote:
> Um, no. That one stops prematurely if
> your input sequence is:
>
> L = 1, 2, 3, 'a', 'a'
Ah, thanks!
> You get points for persistence, however. :)
Maybe this one is better?
from collections import deque
from itertools import chain, repeat
def xsplitter(seq, pred
Anton Vredegoor wrote:
> Maybe this one is better?
No, this one keeps generating output.
But this one stops at least:
from collections import deque
from itertools import chain, repeat
def xsplitter(seq, pred):
Q = deque(),deque()
sentinel = object()
it = chain(seq,rep
[EMAIL PROTECTED] wrote:
> This one gets the order wrong. With
>
> def test():
> L = 1, 2, 3, 'a', 4, 'a', 5, 'a', 6, 'a'
> it1, it2 = xsplitter(L, lambda x: x == 'a')
> print it1.next()
> print it2.next()
> print it1.next()
> print it2.next()
> print it1.next()
>
Anton Vredegoor wrote:
> from collections import deque
>
> def xsplitter(seq, pred):
> Q = deque(),deque()
> it = iter(seq)
> def gen(p):
> for x in it:
> if pred(x) == p:
> Q[p].append(x)
> w
Anton Vredegoor wrote:
> What's up here? Was it a fata morgana? Am I overlooking something?
Even more crazy version:
def xsplitter(seq, pred):
Q = deque(),deque()
it = iter(seq)
def gen(p):
for x in it:
Q[pred(x) == p].append(x)
w
Anton Vredegoor wrote:
> def xsplitter(seq, pred):
> Q = deque(),deque()
> it = iter(seq)
> def gen(p):
> for x in it:
> Q[pred(x) == p].append(x)
> while Q[p]: yield Q[p].popleft()
> while Q[p]: yield Q[p].pople
KDawg44 wrote:
> I am writing a GUI front end in Python using Tkinter. I have
> developed the GUI in a grid and specified the size of the window. The
> widgets are centered into the middle of the window. I would like them
> to fill the window. I tried using the sticky=E+W+N+S option on the
> w
Ray wrote:
> hi, I have a question about how to use .grid_forget (in python/TK)
>
> I need to work on grid repeatly. everytime when a button is pressed,
> the rows of grid is different. such like, first time, it generate 10
> rows of data.
> 2nd time, it maybe only 5 rows. so I need a way to RES
Steve Holden wrote:
>> When cash is involved, it's important to avoid even the slightest
>> hint of a suggestion of a suspicion of a conflict of interest;
>> that, I guess, is why firms that run contests with cash prizes
>> always declare employees and their families "not eligible", and why
>> I t
Antoon Pardon wrote:
>>> That's a good point, and also a valid reason for restricting the
>>> voting community to PSF members. Thanks, Alex.
>> So in order to avoid a suspicion of a conflict of interest you want to
>> turn the whole thing into private property of the PSF?
>>
>> That is the most
Anton Vredegoor wrote:
> It's about as ridiculous as proving that a stiff parrot is dead by
> grabbing it by the legs and repeatedly hitting it's head on the counter.
Or to write "it's" where its is more appropriate.
A.
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
> On 2007-04-25, Anton Vredegoor <[EMAIL PROTECTED]> wrote:
>> Antoon Pardon wrote:
>>
>>>>> That's a good point, and also a valid reason for restricting the
>>>>> voting community to PSF members. Thanks, Alex.
>>
Steve Holden wrote:
> I'm sorry, but while the PSF is a democratically-run organization its
> franchise doesn't extend beyond the membership.
I didn't realize this was about an PSF internal affair. Of course a
group of people can decide on its internal matters without asking anyone
else, as lo
estherschindler wrote:
> * If you telecommute, full- or part-time, what *one* thing do you wish
> the CIO or IT Management would understand that they don't currently
> "get"?
I'm not currently telecommuting but last year I had a telecommuting job
for half a year. What I would want to say to all
Martin v. Löwis wrote:
> In summary, this PEP proposes to allow non-ASCII letters as
> identifiers in Python. If the PEP is accepted, the following
> identifiers would also become valid as class, function, or
> variable names: Löffelstiel, changé, ошибка, or 売り場
> (hoping that the latter one means
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> Martin v. Löwis:
>
> > This PEP suggests to support non-ASCII letters (such as accented
> > characters, Cyrillic, Greek, Kanji, etc.) in Python identifiers.
>
> I support this to ease integration with other languages and
> platform
Neil Hodgson wrote:
> Anton Vredegoor:
>
>> Ouch! Now I seem to be disagreeing with the one who writes my editor.
>> What will become of me now?
>
> It should be OK. I try to keep my anger under control and not cut
> off the pixel supply at the first stirrings o
[EMAIL PROTECTED] wrote:
> I see. I figured that list comprehensions made another list(duh), but
> I thought I could relink the object(List) to the new list and keep it
> once the function ended.
>
> Is it possible to pass a reference(to an object.. Like 'List',
> basically) to a function and chan
Duncan Booth wrote:
> Recently there has been quite a bit of publicity about the One Laptop Per
> Child project. The XO laptop is just beginning rollout to children and
> provides two main programming environments: Squeak and Python. It is an
> exciting thought that that soon there will be mill
HYRY wrote:
>> - should non-ASCII identifiers be supported? why?
> Yes. I want this for years. I am Chinese, and teaching some 12 years
> old children learning programming. The biggest problem is we cannot
> use Chinese words for the identifiers. As the program source becomes
> longer, they always
Raymond Hettinger wrote:
> To make the solutions equi-probable, a simple approach is to
> recursively enumerate all possibilities and then choose one of them
> with random.choice().
Maybe it is possible to generate the possibilities by an indexing
function and then use randint to pick one of the
Terry Reedy wrote:
> Partitioning positive count m into n positive counts that sum to m is a
> standard combinatorial problem at least 300 years old. The number of such
> partitions, P(m,n) has no known exact formula but can be computed
> inductively rather easily. The partitions for m and n
Anton Vredegoor wrote:
> L = [1] * (bins-1) + [0] * (bins-1)
replace these lines in the code by:
L = [1] * (bins-1) + [0] * (bricks-bins)
A.
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy wrote:
> "Anton Vredegoor" <[EMAIL PROTECTED]> wrote in message
> | Yes that was one of my first ideas too. But later on Steven pointed out
> | that one can view the problem like this:
> |
> | 0001100010100
> |
> | That would be [3,4,3,1,2]
&g
Dick Moores wrote:
> If the added constraint is instead that the probability of generating
> a given list of length N be the same as that of generating any other
> list of length N, then I believe my function does the job. Of course,
> [1,46,1,1,1] and [1,1,46,1,1], as Python lists, are distinc
Dick Moores wrote:
> Paul Rubin's fencepost method is about 14 times faster than mine for
> the same M == 8 and N == 4! :(
Actually they looked a bit similar after I had mucked a bit with them
:-) But indeed it's slow.
> Sorry, I don't understand this. Could you spell it out for me by
> rewri
Raymond Hettinger wrote:
> Since people are posting their solutions now (originally only hints
> were provided for the homework problem), here's mine:
Homework problem? Do you have some information from the OP that I can't
find in this thread? Anyway, I consider the 'homework' idea and the
asso
Paul Rubin wrote:
>> def genpool(n, m):
>> if n == 1:
>> yield [m]
>> else:
>> for i in xrange(1, m):
>> for rest in genpool(n-1, m-i):
>> yield rest + [i]
>>
>> import random
>> print random.choice(list(genpool(n=4, m=20)))
>
> This generates a
Anton Vredegoor wrote:
> def memoize(fn):
> cache = {}
> def proxy(*args):
> try: return cache[args]
> except KeyError: return cache.setdefault(args, fn(*args))
> return proxy
Sorry this doesn't work in this case. This works:
def m
n00m wrote:
> 62.5030784639
Maybe this one could save a few seconds, it works best when there are
multiple occurrences of the same value.
A.
from time import time
def freq(L):
D = {}
for x in L:
D[x] = D.get(x,0)+1
return D
def test():
t = time()
f = fil
1 - 100 of 139 matches
Mail list logo