#python - Sat 21 Apr 2007 between 10:51 and 11:09

NY Lost Funds



crackibrend care to explain?
poutineI'm trying to extend/embed python :)
Brendcracki: Explain what?
crackiyour string reversal code?
niltonpoutine: i mean, about your problem now
poutineOk let me hit the pastebin
Brendcracki: Oh. It turns each letter into a list [None, None, ..., None, "x"] where the number of Nones is 1024 minus the string's index in the original
crackiomg
Brendcracki: Then it sorts the resulting list of lists by length, filters out all the nones, extracts the letters, and joins them
crackiamazing
haysthat's gotta be fast
kazzmirim looking for an easy way to detect when my script is on osx, is sys.platform = "darwin" not good enough?
crackiwhat if i wanted to reverse a string longer than 1024 chars?
BrendI tried it with sys.maxint instead of 1024 and ran out of memory :(
haysit uses all that memory heh
BrendFor strings longer than 1024, only the last 1024 characters are reversed
Maybe the last 1023
>>> "".join(map(operator.itemgetter(0), map(lambda x: filter(bool, x), sorted(map(lambda a: [None] * (6-a[0]) + [a[1]], enumerate("hello world")), key=len))))
'world olleh'
(!)
kbrooks:-)
crackii'm still looking for the name of that lambda operator: (lambda f: f(f))(...)
anonymous recursion
hays"".join( b for a,b in sorted(enumerate(list("Foo")),reverse=True))
crackisum(map(str, ???), '')
clajo04Does anyone know where to find the pyllint documentation? The readme says to look in the /doc directory, but there doesn't appear to be a /doc directory when pylint is installed... Also - any informal observations on pylint vs. pychecker?
kbrooksthere are so manyyyy ways to reverse strinyygs. shouldn't we discourage all of them?
crackiall but one
preferably
poutineOk, I suppose what I'm asking is, how do I PyDict_SetItem() with a pointer (not to be used by python) in my own C extension/embedded app
crackithe One True String Reverser
kisielkisn't str[::-1] good enough for reversing strings?
Brend>>> del _r; not map(lambda a: inspect.stack()[1][0].f_locals.__setitem__('_r', a+inspect.stack()[1][0].f_locals.get('_r',"")), "hello world") or _r
'dlrow olleh'
crackiuse __import__("inspect")
actionBrend is particularly proud of the "not ... or _r" trick
Brendis particularly proud of the "not ... or _r" trick
haysthat is pretty nice
clajo04Brend: what in the world motivated you to come up with that "trick"?
Brendclajo04, well this _is_ a silliness competition
clajo04Understood, but that's pretty much over the top... I've got to use that for the next P*rl vs. Python debate that I get into...

Page: 5 12 19 26 33 40 47 54 61 

IrcArchive

NY Lost Funds