Ciao, Shane Hathaway! Che stavi dicendo?
> I'm down to 133 characters (counted according to 'wc -c') on a single
> line. It contains about 11 whitespace characters (depending on what you
> consider whitespace.)
$ wc -c seven_seg.py
137 seven_seg.py
$ sed 's/ //g' seven_seg.py|wc -c
120
(yeah, to
Ciao, KraftDiner! Che stavi dicendo?
> I have two lists...
>
> a=[1,2,3]
> b=[4,5,6]
>
> n=0
> for i in a:
>print i, b[n]
>n=n+1
>
> how can i have two iterators on my for loop?
for i,j in zip(a,b):
print i,j
--
Quante sono le persone
che sanno leggere il codice esadecim
Stephan Kuhagen wrote:
>> #!/bin/sh
>> """exec" python "$0" "$@"""
>
> Wow, cool... I like that!
yeah, but...
$ cat test.py
#!/bin/sh
"""exec" python "$0" "$@"""
print "Hello, world"
$ file test.py
test.py: Bourne shell script text executable
--
Under construction
--
http://mail.python.org/
Erik Max Francis wrote:
> The file _is_ a /bin/sh executable. You're just having that /bin/sh
> executable run something else -- how could `file` figure that out
> without a ridiculously complicated set of rules that rise to the level
> of a sh interpreter -- thereby, defeating the purpose?
but.
Dennis Lee Bieber wrote:
>> Can the input to the python script be given from the same file as the
>> script itself. e.g., when we execute a python script with the command
>> 'python >
> Redirecting? Ugh...
>
> Off-hand, I'd say NO
>
> There is no way to tell the python interpreter where the pro
Paul Rubin wrote:
>> A = [0,1,2,3,4,5,6,7,8,9,10]
>> B = [2,3,7,8]
>>
>> desired_result = [2,3,7,8,0,1,4,5,6,9,10]
>
> How about:
>
> desired_result = B + sorted(x for x in A if x not in B)
this. is. cool.
--
Under construction
--
http://mail.python.org/mailman/listinfo/python-list
Eli Criffield wrote:
> Here is what i want to do. I have a question in my program, and i want
> to do tab completion for the valid answers.
I think you may "play" width curses library: readline() read... while you
input a "newline", but you need to catch single keys (the "TAB" key,
foremost)
--
Bruno Desthuilliers wrote:
>> I decided to change the name of an attribute. Problem is I've used the
>> attribute in several places spanning thousands of lines of code. If I
>> had encapsulated the attribute via an accessor, I wouldn't need to do
>> an unreliable and tedious search and replace
> f
hollowspook wrote:
> how about indexing 1-7, 10
> [range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
> [1, 2, 3, 4, 5, 6, 7, 10]
>>> range(1,8)+[10]
[1, 2, 3, 4, 5, 6, 7, 10]
--
Under construction
--
http://mail.python.org/mailman/listinfo/python-list
Peter Machell wrote:
> I have an application where I need to take a query from an existing
> database and send it to a web api.
[...]
> There are always 5 values, but some are blank and some are 'None'.
> I'd like to split the lines so I get something resembling XML, like this:
> Frank
> Spencer
Ciao, Juho Schultz! Che stavi dicendo?
> should work. IMO file.write() is self-explanatory but "print >> file" is
> a bit obscure.
is obscure only if you have never used a shell :)
--
Evangelion e' la storia yaoi di un angelo che vuole portarsi a letto un
ragazzo che si intreccia con la storia
Ciao, John Salerno! Che stavi dicendo?
> for (int i = 0; i < 50; i += 5)
>
> How would that go in Python, in the simplest and most efficient way?
i=0
while i<50:
#...
i+=5
about range()/xrange(): what if you want to traslate this c-loop?
for (int i=1; i<50; i*=2)
--
Evangelion e' la s
Neil Hodgson wrote:
> Ada 2005 allows Unicode identifiers and even includes the constant
> '?' in Ada.Numerics.
this. is. cool.
(oh, and +1 for the pep)
--
Under construction
--
http://mail.python.org/mailman/listinfo/python-list
yomgui wrote:
> I use eclipse for python and cvs, what is "the" good alternative ?
"the" good alternative, I dont know.
But a good solution is eric3 (http://www.die-offenbachs.de/detlev/eric.html)
--
Under construction
--
http://mail.python.org/mailman/listinfo/python-list
Boris Borcic wrote:
>>> For example, if I have x=[ [1,2], [3,4] ]
>>> What I want is a new list of list that has four sub-lists:
>>> [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
>> [[a, map(f,a)] for a in x]
> [map(g,a) for a in x for g in [None,f]]
> will do it.
>
> ...a bit too cleverly, but ther
ZeeGeek wrote:
> in the code returned by Live Space, they use instead of so
> that Blogger will complain that this tag is not valid because it
> doesn't have a closing tag. Another example is that the contents of a
> lot of the tag attributes like "color" and "size" are not surrounded
> by quot
cesco wrote:
> The list is composed of objects:
> l = [obj1, obj2, obj3, obj4]
> and I need to call a method (say method1) on each object as follow:
> l1 = [obj1.method1(obj2), obj2.method1(obj3), obj3.method1(obj4),
> obj4]
to me it sounds a bit different from the original request, but...
> Is
thebjorn wrote:
>> >>> int("020")
>> 20
>> >>> 020
>> 16
>
> You can get the latter behavior using eval:
why using eval when int has the "base" optional parameter?
>>> int("020")
20
>>> int("020", 8)
16
>>> int("09", 8)
Traceback (most recent call last):
File "", line 1, in
ValueError: inval
Johny wrote:
>> >Let suppose I want to find a number 324 in the text
>>
>> >'45 324 45324'
>>
>> >there is only one occurrence of 324 word but string.find() finds 2
>> >occurrences ( in 45324 too)
>>
>> >>> '45 324 45324'.split().count('324')
>> 1
>> >>>
>>
>> ciao
> Marco,
> Th
Grant Edwards wrote:
> The user-defined xor is operates on "logical" boolean values.
> The one in the operator module is a bitwise operator.
def xor(a, b):
return bool(a) ^ bool(b)
seems more explicit to me.
maybe, to make "more" explicit (too much, onestly...)
from operator import xor as b
Jair Trejo wrote:
> I was wondering how and if it's possible to write a
> loop in python
> which updates two or more variables at a time. For
> instance, something
> like this in C:
>
> for (i = 0, j = 10; i < 10 && j < 20; i++, j++) {
> printf("i = %d, j = %d\n", i, j);
> }
>>> for i,j in z
Michele Simionato wrote:
> Python 2.4.4 (#2, Oct 4 2007, 22:02:31)
file is open
> True
>
> Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
file is open
> False
>
> Nowadays file is no more an alias for open.
curious... maybe it's me, but I can't find a "What's New in Python" where
t
Ciao, [EMAIL PROTECTED] Che stavi dicendo?
> Is there a simple way to create a list of independent lists?
N=3
x=[[0] for e in range(N)]
--
Up da 1 giorno, 3 ore, 43 minuti e 10 secondi
--
http://mail.python.org/mailman/listinfo/python-list
the link: http://okayzed.github.com/dmangame/introduction.html
dmangame is a game about writing AI for a simple strategy game.
an example game: http://okayzed.github.com/dmangame/circleblaster_vs_expand.html
there are some example / more advanced AI in the dmanai repository
(http://github.com/ok
could be the ACM queue challenge and google's ai challenge, they've
had games in the past with somewhat similar mechanics
On Jun 5, 11:10 pm, James Mills wrote:
> On Mon, Jun 6, 2011 at 3:50 PM, okay zed wrote:
> > the link:http://okayzed.github.com/dmangame/introduction.
about the approach I
took with the book and what you think.
Thanks for your time.
Zed
P.S. The book is totally free so long as you don't charge for it and
you don't change it or break it up. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Using this you can find out
anything you need with just basic file operations.
Use: man proc to find our more.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
--
http://mail.python.org/mailman/listinfo/python-list
the core of the project are on the
above page.
Since I'm a total Python newbie, I'd love any advice about my code I
can get.
Thanks much.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
--
http://mail.python.org/mailman/listinfo/python-list
or send me patches.
Suggested features that don't involve major changes are more than
welcome.
== NEXT FEATURES
* A few recipes to make building common stuff easy, like generating
setup.py and so on.
* A way to load modules from trusted locations.
* Documentation, built with Vellum and Id
nts are welcome, especially about the actual safety of the code in
vellum/parser.g and vellum/parser.py (generated by Zapps).
Have fun.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
--
http://mail.python.org/mailman/
DBACK
Let me know if you run into anything, and if you like it or hate it.
Otherwise, enjoy the gear.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
--
http://mail.python.org/mailman/listinfo/python-list
ed to release
the commands.
However, I'm curious to get other people's thoughts.
Thanks a bunch folks.
--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
--
http://mail.python.org/mailman/listinfo/python-list
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)))]
--
to line up the nth format specifier with the nth
> data item.
well, in python3 you can use dict to format strings
>>> print("%(a)s" % {'a':'b'})
b
and you can achieve php interpolation via locals()
>>> a = 'b'
>>> print("%(a)s" % locals())
b
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
efined scheme, host, port, route and fragment?
or you think also this is "code smell"?
2) I'm in no way modifying the dict, just accessing in read only.
3) I'm restricting to locals() :D
btw I never used dict to format strings, so I learned how old this feature
is :D
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
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
uch any other serious "programmer editor"
program try to do its best to deal with line wrap: the minimal I found is
the wrapped line is "indented" at the same level of the flow, but I found
editors where you can specify what to do (generally something like "indent
the wra
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 autocomple
i in xrange(-1, -20, -1)]:
>>
>
> It's a little obfuscated ;) I would go for the simple:
>
> for i in xrange(21):
> suffix = "-%s" % i if i else ""
>
>
obfuscated for obfuscated, you can merge the two ideas:
for suffix in ('-%s' % i if i else '' for i in xrange(21)):
...
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
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
etween (say) ??? ??? and -.
>
> My point is that if it's an ASCII file,
source files aren't (necessary) ASCII files
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
ake a
look at the deque[0] module.
If you want "true lists" (um... "linked list"?) there are is this recipe[1]
you might look.
[0] http://docs.python.org/library/collections.html#collections.deque
[1] http://code.activestate.com/recipes/577355-python-27-linked-list-vs-
l
;reversed'
ll.reversed = True
n = n_previous
while n is not None:
print n.value
n = n.nextNode()
if __name__ == '__main__':
main()
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
n bool(big_beast)?
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
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
tion" of python: one
for each release of CPython (2.0, 2.1.2, 2.6.1, 3.x.y...), multiplied for
each OS multiplied for IronPython, Jython, Pypy... etc...
(obviously the
"implementation details" between, say, CPython 2.6.1 and 2.6.2 are really
minor vs Pypy X.Y.Z and IronPython A.B
ne --obvious way to do it."
> 3) In Python 3, why does 2.0 / 3.0 display as 0., but 8 *
> 3.57 displays as 28.56 (rounded off to 2 decimal places)? And yet, in
> Python 2.6, 8 * 3.57 displays as 28.559?
http://mail.python.org/pipermail/python-dev/200
n erlang-style "bang" (!) process message
passing?
--
By ZeD
--
http://mail.python.org/mailman/listinfo/python-list
Traceback (most recent call last):
File "./test_data_manip.py", line 23, in test_sample
with self.assertRaises(ValueError):
TypeError: failUnlessRaises() takes at least 3 arguments (2 given)
--------
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
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
51 matches
Mail list logo