Paul Rubin wrote:
> [EMAIL PROTECTED] writes:
>> assert magic_function(3+4)=="3+4"
>> assert magic_function([i for i in range(10)])=="i for i in range(10)]"
>>
>> It is not trivial at all and might require some bytecode hacking that i
>> am unable to do myself BUT you are the experts ;-)
>
> Guhhh
sa wrote:
> in k:
>
> cp:{[c;n;p]+(n#c)_vs(!_ c^n)_dvl,/{2_sv+(,/,/:\:)/(),/:@[x;&x=-1;:[;!c]]}'p}
That one goes a long way as a proof of eg evolution theory, you know,
monkeys reproducing shakespeare with a typewriter k-board and all that :)
>
> examples:
>
> cp[2;3;,0 -1 1]
> (0 0 0
> 0
Wildemar Wildenburger wrote:
> just to bloat this thread some more:
>
> Am I the only one using jEdit?
I've yet to find better for developing in jython
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> There is an article on oreilly.net's OnLamp site called "The World's
> Most Maintainable Programming Language"
> (http://www.oreillynet.com/onlamp/blog/2006/03/the_worlds_most_maintainable_p.html).
>
>
>
> It's not about a specific language, but about the qualities that
Peter Hansen wrote:
> flamesrock wrote:
>> Hi,
>>
>> Are there any good decompilers for python?
>
> Decompyle can manage any version from 1.5 up to 2.3.3.
I was disappointed when I started to play with decompyle for python 2.3
to observe that it failed on non-trivial list comprehensions.
--
htt
generators challenge
define "limit" and "itially"
so that
limit(foo(x) for x in itially(bar))
works out the same as
limit2(foo,bar)
with
def limit2(foo,bar) :
bar1 = foo(bar)
while bar != bar1 :
bar1,bar = foo(bar),bar1
Azolex wrote:
> generators challenge
>
>
> define "limit" and "itially"
>
> so that
>
> limit(foo(x) for x in itially(bar))
>
> works out the same as
>
> limit2(foo,bar)
>
> with
>
> def lim
Paul McGuire wrote:
> Howzis?
>
> -- Paul
>
>
> class Bag:
> pass
> data = Bag()
> data.x = None
>
> def itially(bar):
> if data.x is None:
> data.x = bar
> while 1:
> yield data.x
>
> def limit(z):
> eps = 1e-10
> done = False
> z2 = z.next()
> z1 =
[counting all (possibly overlapping) occurences of a substring in a string]
def count_subs(s,subs,pos=0) :
pos = 1+s.find(subs,pos)
return pos and 1+count_subs(s,subs,pos)
or equivalently
def count_subs(s,subs)
pos,cnt = 0,0
while True :
pos = 1+s.find(subs,pos)
Steve R. Hastings wrote:
> On Thu, 06 Apr 2006 09:08:45 +1000, Steven D'Aprano wrote:
>> Yes, the above example is a good use case for xrange. Did you think that
>> anyone denied that there were good cases for it?
>
> I am now officially sorry for starting this thread.
Don't. It's quite funny, th
a couple more exotic variations
print (10 * "%s ") % tuple(range(10))
print filter(lambda x : x not in "[,]",str(range(10)))
--
http://mail.python.org/mailman/listinfo/python-list
Steve R. Hastings wrote:
> On Thu, 06 Apr 2006 02:33:16 +0200, Azolex wrote:
>> Don't. It's quite funny, thanks.
>
> I guess I should laugh. :-/
>
>
> When you read my original articles, did *you* think I was proposing that
> range() be changed to always
I wrote:
> [counting all (possibly overlapping) occurences of a substring in a string]
>
> def count_subs(s,subs,pos=0) :
> pos = 1+s.find(subs,pos)
> return pos and 1+count_subs(s,subs,pos)
> .
now to push lisp-style to the extr
Michele Simionato wrote:
> Steven Bethard wrote:
>> The PEP is based on a suggestion [1]_ from Michele Simionato on the
>> python-dev list.
>
> True, but I would also mention that the idea of the 'create' keyword
> come from
> Nick Coghlan:
>
> http://mail.python.org/pipermail/python-dev/2005-Oct
Steven Bethard wrote:
...
>
> Optional Extensions
> ===
>
> Remove the create keyword
> -
>
> It might be possible to remove the create keyword so that such
> statements would begin with the callable being called, e.g.:
>
> module mod:
> def f
just couldn't help taking the bait...
def morris(seed) :
"""
>>> m = morris('3447221')
>>> m.next()
'1324172211'
>>> m.next()
'1113121411172221'
>>> m.next()
'31131112111431173211'
"""
assert isinstance(seed,basestring) and seed.isdigit(),"bad se
Michael Yanowitz wrote:
>
> At-least Pythetic isn't a word (yet).
>
:))) "now that's quite pythetic !"
hmmm, clearly that word could become damaging to python,
so I suggest the best course is to preventively focus the meaning
in a way that prevents the danger, by providing canonical
examples
Lonnie Princehouse wrote:
> Here's my take on the thing. It only prints one term, though.
>
> http://www.magicpeacefarm.com/lonnie/code/morris.py.html
>
> (a bit too long to post)
>
excerpt :
def morris(seed, n):
"""..."""
if n == 1:
return seed
else:
re
WENDUM Denis 47.76.11 (agent) wrote:
>
> While testing recursive algoritms dealing with generic lists I stumbled
> on infinite loops which were triggered by the fact that (at least for my
> version of Pyton) characters contain themselves.
Note that the empty string is contained in all strings,
Daniel Nogradi wrote:
>> "The Dice" (find tech jobs) has offerings
>> (last 7 days, U.S. + unrestricted) for:
>>*SQL 14,322
>>C/C++11,968
>>Java 10,143
>>...
>
> Can anyone shed some light on the secret of Java? How is it that they
> are so high on this list?
Sun inven
Steven Bethard wrote:
> I've updated the PEP based on a number of comments on comp.lang.python.
> The most updated versions are still at:
>
> http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt
> http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html
>
> In this post, I
Raymond Hettinger wrote:
>
> The cult of lambda avoidance has lost contact with reality. [...]
> Lambda avoidance is rooted in two things, an aversion to the keyword
> name [...]
Let's push the diagnosis a bit further : the aversion to the keyword
"lambda" has to do with the fact that it ignore
Alex Martelli wrote:
> Jeffrey Froman <[EMAIL PROTECTED]> wrote:
>
>> Alex Martelli wrote:
>>
>>> I've never seen an "object-relational mapping" (technical
>>> term for cruft that tries to avoid people having to learn and use SQL)
>>> which doesn't drive me into a murderous, foam-at-mouth rage in
Raymond Hettinger wrote:
> Azolex:
>> Let's push the diagnosis a bit further : the aversion to the keyword
>> "lambda" has to do with the fact that it ignores the english word used
>> by all non-geeks to convey the meaning, eg "given"
>
> Ri
Bill wrote:
> Hello --
> I'm parsing the output of the finger command, and was wondering
> something...If I'm given a month abbrievation (such as "Jan"), what's
> the best way to figure out the month number?
> I see that there's
> something called "month_abbr" in the calendar module. However, whe
John Salerno wrote:
> Bill wrote:
>
>> def month_number(monthabbr):
>> """Return the month number for monthabbr; e.g. "Jan" -> 1."""
>> for index, day in enumerate(calendar.month_abbr):
>> if day == monthabbr:
>> return index
>>
>> which works well enough but isn't very
[EMAIL PROTECTED] wrote:
> Hi,
>
> I just started with Python and I am new to OO programming.
> Here is a simple code:
> "
> class Obj:
> myVar = 1
>
> def __init__(self):
> myVar = 2
>
> #
>
>
> myObj = Obj()
>
> print myObj.myVar
> "
>
> The output is of this scri
Steven Bethard wrote:
> Rob Williscroft wrote:
>> I don't know wether this has been suggested or not, but what about def:
>>
>> def namespace ns:
>> x = 1
>>
>> def type blah(object):
>> pass
>>
>> def property x:
>> def get():
>> return ns.x
>
> I think that's probably a bad idea
28 matches
Mail list logo