Arnaud Delobelle wrote:
> On 1 December 2011 03:15, Roy Smith wrote:
>> I need to try a bunch of names in sequence until I find one that works
>> (definition of "works" is unimportant). The algorithm is:
>>
>> 1) Given a base name, "foo", first see if just plain "foo" works.
>>
>> 2) If not, try
http://scummos.blogspot.com/2011/09/kdev-python-argument-type-guessing.html
I'm not used to big ide/rad for python... but I think this work is
excellent!
Are there alternatives (pydev? others?) capable of this sort of thinks (I
mean "guessing the type" and method autocomplete)
--
By ZeD
--
Yingjie Lan wrote:
> :The trouble of dealing with long lines can be avoided by a smart
> :editor. It's called line wrap.
>
> Yeah, usually they just wrap it pretty arbitrarily,
> and you don't have any control, isn't it?
umm... besides "notepad" pretty much any other serious "programmer editor"
David Robinow wrote:
> On Sat, Aug 6, 2011 at 1:23 PM, Kabie wrote:
>> No.
>> L1, L2 = zip(*L)
>
> Not quite. That makes L1 & L2 tuples.
>
> L1, L2 = zip(*L)
> L1 = list(L1)
> L2 = list(L2)
> ???
L1, L2 = map(list, zip(*L))
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
>> and you can achieve php interpolation via locals()
>>
> a = 'b'
> print("%(a)s" % locals())
>> b
>
> You can do that, but when reading code I consider any direct use of
> locals() (and globals() for that matter) to be a code smell:
well you're right, me neither
Roy Smith wrote:
> There's something nice about building up strings in-line, as
> opposed to having to look somewhere to see what's being interpolated.
> To give a more complex example, consider:
>
> print "$scheme://$host:$port/$route#$fragment"
>
> That certainly seems easier to me to read tha
jyoun...@kc.rr.com wrote:
> I was surfing around looking for a way to split a list into equal
> sections.
non-recursive, same-unreadeable (worse?) one liner alternative:
def chunks(s, j):
return [''.join(filter(None,c))for c in map(None,*(s[i::j]for i in
range(j)))]
--
By ZeD
--
http:/
Steven D'Aprano wrote:
> I can't see any way to go from this linked list:
>
> node1 -> node2 -> node3 -> node4 -> node5 -> node6 -> node7
>
> to this:
>
> node1 -> node6 -> node5 -> node4 -> node3 -> node2 -> node7
>
> in constant time. You have to touch each of the nodes being reversed.
very
Dmitry Groshev wrote:
> Is there any way to use a true lists (with O(c) insertion/deletion and
> O(n) search) in python? For example, to make things like reversing
> part of the list with a constant time.
if you're interested just in "reverse" a collection maybe you can take a
look at the deque[
Lawrence D'Oliveiro wrote:
> You know what, I think I actually prefer the trick to Python’s
> backwards-if syntax...
fact = lambda x: x*fact(x-1) if x>1 else 1
naa, it's not too bad...
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
Benjamin Kaplan wrote:
> You're looking at the 2.7 documentation. Are you using 2.7?
whoops, no: 2.6.5 :\
(but the "new in python X.Y.Z" disclaimer does not apply to the example
snippets?)
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
from http://docs.python.org/library/unittest.html
-->8>8>8>8>8>8>8>8>8>8>8>8--
Here is a short script to test three functions from the random module:
import random
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
Hi all.
I know, maybe I'm just lazily speculating, but I'm curious about what's
next, in python, when GvR will stop the moratorium and will let changes in
the language.
I don't know what to expect... some syntax sugar about concurrent
programming? static types? an erlang-style "bang" (!) proce
Default User wrote:
>>From "the emperor's new clothes" department:
>
> 1) Why do Python lists start with element [0], instead of element [1]?
> "Common sense" would seem to suggest that lists should start with [1].
http://userweb.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
> 2)
Richard D. Moores wrote:
> So there would be a different implementation
for each operating
> system? One for Windows, one for linux? Or one for
Vista and one for
> XP? I'm just trying to clarify what is meant by
"implementation".
there are dozillions of "implementation" of python: one
for each r
Peng Yu wrote:
> I mainly check online python manual. But I feel that it would be nice
> if there is command line manual available (just like perl command line
> manual). Could you please let me know if such command line manual
> available?
pydoc?
--
By ZeD
--
http://mail.python.org/mailman/
Peter Otten wrote:
> def f():
> big_beast = list(range(10**100))
> return big_beast and True or False
> x = f()
>
> it would prevent that a big_beast reference becomes visible outside the
> function and allow for immediate release of its memory.
what's wrong in bool(big_beast)?
--
By Z
Grant Edwards wrote:
>> As for not being able to see the difference between a hyphen and an
>> EN- dash, or minus sign, or whatever it is, yes but they are very
>> similar looking glyphs in virtually ever modern font. It would take a
>> good eye to see the difference between (say) ??? ??? and -.
>
Steven D'Aprano wrote:
>> if I run 'python <<< "import sys; print(sys.ps1)"', I get an error.
>
> Of course you do, because you're not running interactively
Excuse me, why do you say that?
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
19 matches
Mail list logo