web2py 1.56 is out, including a new web site with better documentation
http://www.web2py.com
What is web2py?
=
- It is the web framework used by PyCon 2009 for registration.
- It a very easy and very powerful Python web framework.
- It is fast and rock solid. It has a very
looking at the eXtreme Programing fuckheads's traffic history:
http://groups.google.com/group/comp.software.extreme-programming/about
for those who are not aware, it was one of the snake oil wildly
popular in around 2001.
Xah
∑ http://xahlee.org/
☄
Jason wrote:
I just started reading OnLisp
thmpsn@gmail.com a écrit :
On Feb 4, 3:11 am, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
thmpsn@gmail.com a écrit :
On Feb 3, 1:14 am, David Cournapeau courn...@gmail.com wrote:
(snip)
after all, we have used FILE* for years and I have no idea about the
On Feb 5, 1:18 am, Chris Rebert c...@rebertia.com wrote:
For an integer:
is_even = bin(the_int)[2:].count('1') % 2 == 0
But the OP has to use if and while. How about:
while 2+2 != 5:
if 'wkw' in 'just being awkward':
is_even = bin(the_int)[2:].count('1') % 2 == 0
break
or
Hi all,
So, I can run this in the ipython shell just fine:
===
a = [12, 15, 16, 38.2]
dim = int(sqrt(size(a)))
dim
2
===
But if I move these commands to a function in another file, it freaks out:
=
a = distances_matrix.split('\t')
from
Hi,
Vincent Davis wrote:
Sorry for not being clear
I would have something like this
x = [1, 2, 3,5 ,6 ,9,234]
Then
def savedata(dataname): ..
savedata(x)
this would save a to a file called x.csv This is my problem, getting the
name to be x.csv which is the same as the name of the
On Thu, Feb 5, 2009 at 1:08 AM, Nick Matzke mat...@berkeley.edu wrote:
Hi all,
So, I can run this in the ipython shell just fine:
===
a = [12, 15, 16, 38.2]
dim = int(sqrt(size(a)))
sqrt() is not a builtin function, it's located in the 'math' module.
You must have imported it at
Hi Len,
First off, there's the wxPython mailing list
(To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users or, via email, send
a message with subject or body 'help' to
wxpython-users-requ...@lists.wxwidgets.org)
I also find Google
Tim H wrote:
On Win XP 64bit, Python 2.6.1 64bit
I am trying to rename files by their creation time.
It seems the time module is too smart for its own good here.
time.localtime(os.path.getctime(f)) returns a value one hour off from
what windows reports for files that were created when
On Feb 4, 10:20 pm, Nick Matzke mat...@berkeley.edu wrote:
So I have an interesting challenge. I want to compare two book
chapters, which I have in plain text format, and find out (a) percentage
similarity and (b) what has changed.
no idea if it will help, but i found this yesterday -
On Feb 4, 2:48 pm, srinivasan srinivas sri_anna...@yahoo.co.in
wrote:
Hi,
Could someone tell me the way to add body to the instance
email.mime.multipart.MIMEMultipart instance which has attachments?
Thanks,
msg = MIMEMultipart()
msg.preamble = 'This is a multi-part message in MIME
On Feb 4, 9:44 pm, Tim Rowe digi...@gmail.com wrote:
That just leaves me puzzled as to why Mark Summerfield used it instead
of a check against zero on user input.
No idea: you'd have to ask Mark Summerfield. If there's
an email address published in his book, I'm sure he
wouldn't object to the
Choosing the right data structure is usually a matter of compromises,
and sometimes the best you can do is to change some data structures
and look for the faster running time. To do this it helps to have a
language that allows you to swap data structures in the more
transparent way possible.
It's
Hendrik van Rooyen wrote:
MRAB goo...@mrett.plus.com wrote:
The actual names of the variables and functions shouldn't matter to the
outside world; the name of an output file shouldn't depend on the name
of a variable.
That is a matter of opinion.
It is however, an interesting
2009/2/5 Duncan Booth duncan.bo...@invalid.invalid:
Mark Dickinson dicki...@gmail.com wrote:
def count_set_bits(n):
# make sure we include an if, to
# satisfy OP's requirements:
if n 0:
raise ValueError
count = 0
while n:
count += 1
n = n-1
andrew cooke wrote:
On Feb 4, 10:20 pm, Nick Matzke mat...@berkeley.edu wrote:
So I have an interesting challenge. I want to compare two book
chapters, which I have in plain text format, and find out (a) percentage
similarity and (b) what has changed.
no idea if it will help, but i found
bearophileh...@lycos.com wrote:
[a somewhat feeble case for ordered dicts]
Once the default dicts are ordered, it can be possible to add an
unordereddict to the collections module to be used by programmers when
max performance or low memory usage is very important :-)
I have no real idea why
Steve Holden st...@holdenweb.com writes:
In mathematics mappings aren't ordered either, and a pure dict is pretty
much a mapping. So leave them alone, they are fine as they are!
Ehhh, an ordered dict has to support a comparison operation on the
keys, while a Python dict has to support a hashing
That, my friend, is ingenious...!
Thankyou
SM
2009/2/3 andrew cooke and...@acooke.org
ValueError: unconverted data remains: this is the remainder of the log
line
that I do not care about
you could catch the ValueError and split at the ':' in the .args
attribute to find the extra
Hi All
I've written a simple python script that accepts both stdin and a glob (or
at least, that is the plan).
Unfortunately, the glob part seems to hang when it's looped through to the
end of the filehandle.
And I have no idea why... ;-)
sys.stdin and a normal file opened with open seem to
Paul Rubin http://phr...@nospam.invalid wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in
Brian Allen Vanderburg II a écrit :
I'm trying to better understand descriptors and I've got a few questions
still after reading some sites. Here is what I 'think', but please let
me know if any of this is wrong as I'm sure it probably is.
First when accessing an attribute on a class or
I just recently learned python, I'm using it mainly to process huge
5GB txt files of ASCII information about DNA. I've decided to learn
3.0, but maybe I need to step back to 2.6?
I'm getting exceedingly frustrated by the slow file IO behaviour of
python 3.0. I know that a bug-report was submitted
Duncan Booth duncan.bo...@invalid.invalid writes:
If you want to write doctests then any stable order in the default dict
type would be helpful no matter whether it means that keys are in original
insertion or latest insertion order or sorted.
Just use sorted in the test code:
print
thomasvang...@gmail.com wrote:
C:\python30 patch -p0 fileio_buffer.patch
The patch command is not recognized..
You need the 'patch' program first. Further, you will need a C compiler. If
you don't know how to compile from sources, I would postpone patching
sources to after learning that.
2009/2/5 Duncan Booth duncan.bo...@invalid.invalid:
I remember a programming exercise when I was an undergraduate and
anyone who *didn't* use that trick got marked down for writing
inefficient code.
Is adding and a modulus *really^ more efficient than flipping a bool
as I suggested? I think
On 2009-02-05 03:49, KMCB wrote:
Thanks Simon and Marc,
I currently have an app on OSX that I wanted to migrate to NIX, it
uses a ODBC DBAPI interface to communicate with Filemaker.
Unfortunately, FMP does not support linux drivers. They do have a
JDBC driver that looks like it may work.
Tim Rowe digi...@gmail.com wrote:
2009/2/5 Duncan Booth duncan.bo...@invalid.invalid:
Mark Dickinson dicki...@gmail.com wrote:
def count_set_bits(n):
# make sure we include an if, to
# satisfy OP's requirements:
if n 0:
raise ValueError
count = 0
while n:
Mark Dickinson dicki...@gmail.com wrote:
def count_set_bits(n):
# make sure we include an if, to
# satisfy OP's requirements:
if n 0:
raise ValueError
count = 0
while n:
count += 1
n = n-1
return count
is_even = count_set_bits(the_int)
On Thu, Feb 5, 2009 at 3:40 AM, S.Selvam Siva s.selvams...@gmail.com wrote:
Hi all,
I tried to do a string replace as follows,
s=hi people
s.replace(,\)
'hi \\ people'
but i was expecting 'hi \ people'.I dont know ,what is something different
here with escape sequence.
The Python
On 2009-02-05 02:20, Nick Matzke wrote:
Hi all,
So I have an interesting challenge. I want to compare two book
chapters, which I have in plain text format, and find out (a) percentage
similarity and (b) what has changed.
Some features make this problem different than what seems to be the
On 2009-02-05 10:08, Nick Matzke wrote:
Hi all,
So, I can run this in the ipython shell just fine:
===
a = [12, 15, 16, 38.2]
dim = int(sqrt(size(a)))
dim
2
===
But if I move these commands to a function in another file, it freaks out:
You need to add:
from math
bruno.42.desthuilli...@websiteburo.invalid wrote:
So the lookup chain is:
1/ lookup the class and bases for a binding descriptor
2/ then lookup the instance's __dict__
3/ then lookup the class and bases for a non-binding descriptor or
plain attribute
4/ then class __getattr__
Also and FWIW,
Paul Rubin http://phr...@nospam.invalid wrote:
Duncan Booth duncan.bo...@invalid.invalid writes:
If you want to write doctests then any stable order in the default
dict type would be helpful no matter whether it means that keys are
in original insertion or latest insertion order or sorted.
Hi all,
I tried to do a string replace as follows,
s=hi people
s.replace(,\)
'hi \\ people'
but i was expecting 'hi \ people'.I dont know ,what is something different
here with escape sequence.
--
Yours,
S.Selvam
--
http://mail.python.org/mailman/listinfo/python-list
thomasvang...@gmail.com schrieb:
I just recently learned python, I'm using it mainly to process huge
5GB txt files of ASCII information about DNA. I've decided to learn
3.0, but maybe I need to step back to 2.6?
I'm getting exceedingly frustrated by the slow file IO behaviour of
python 3.0.
S.Selvam Siva s.selvams...@gmail.com wrote:
I tried to do a string replace as follows,
s=hi people
s.replace(,\)
'hi \\ people'
but i was expecting 'hi \ people'.I dont know ,what is something different
here with escape sequence.
You are running into the difference between the
Hi Chris
2009/2/5 Chris Rebert c...@rebertia.com
I'd add some print()s in the above loop (and also the 'for f in files'
loop) to make sure the part of the code you didn't want to share (do
stuff with the line) works correctly, and that nothing is improperly
looping in some unexpected way.
On Thu, Feb 5, 2009 at 2:58 AM, Simon Mullis si...@mullis.co.uk wrote:
Hi All
I've written a simple python script that accepts both stdin and a glob (or
at least, that is the plan).
Unfortunately, the glob part seems to hang when it's looped through to the
end of the filehandle.
And I have
Martin v. Löwis wrote:
Is it the
x64 working faster at its design sizes
Another guess (still from the darkness of not having received the
slightest clue what the test actually does): if it creates integers
in range(2**32, 2**64), then they fit into a Python int on AMD64-Linux,
but require a
Hello everyone,
So I have this function I want to map onto a list of sequences of
*several* arguments (while I would want to pass those arguments to each
function in the normal fashion). I realize this is contrived, maybe an
example would make this clear:
params = [ ('comp.lang.python',
so what is happening with pep 372?
http://www.python.org/dev/peps/pep-0372/
--
http://mail.python.org/mailman/listinfo/python-list
...
--
Ran 193 tests in 27.841s
OK
real0m28.150s
user0m26.606s
sys 0m0.917s
[rpt...@localhost tests]$
magical how the total python time is less than the real time.
time(1) also measures the Python startup
can someone help me please
#open file and read last names
filename = input('name file')
file = open(filename, 'r')
names_list = file.readlines()
file.close()
#open a file for saving passwords
outfile_name = input('Save passwords')
outfile = open(outfile_name, 'a')
#create a password for each
mk wrote:
So I have this function I want to map onto a list of sequences of
*several* arguments (while I would want to pass those arguments to each
function in the normal fashion). I realize this is contrived, maybe an
You can either use a list comprehension
[f(*args) for args in seq]
or
Forget it all... I was being very very daft!
The default = 'False' in the options for stdin was not being
evaluated as I thought, so the script was waiting for stdin even when
there was the glob switch was used...No stdin equals the script
seeming to hang.
Ah well.
SM
--
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]]
print flatten(a)
[1, 2, 3, 4,
andrew cooke schrieb:
so what is happening with pep 372?
http://www.python.org/dev/peps/pep-0372/
It's still a draft and hasn't been implemented yet. Now is the time to
get it ready for Python 3.1 and 2.7.
Christian
--
http://mail.python.org/mailman/listinfo/python-list
Quoth Christian Heimes li...@cheimes.de:
thomasvang...@gmail.com schrieb:
I just recently learned python, I'm using it mainly to process huge
5GB txt files of ASCII information about DNA. I've decided to learn
3.0, but maybe I need to step back to 2.6?
I'm getting exceedingly
#open file and read last names
filename = input('name file')
file = open(filename, 'r')
names_list = file.readlines()
file.close()
#open a file for saving passwords
outfile_name = input('Save passwords')
outfile = open(outfile_name, 'a')
#create a password for each name in list
import random,
Last try at getting the indenting to appear correctly..
#!/usr/bin/env python
import glob, os, sys
class TestParse(object):
def __init__(self):
if options.stdin:
self.scan_data(sys.stdin)
if options.glob:
self.files = glob.glob(options.glob)
mrk...@gmail.com wrote:
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]]
print
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you inserted them
in. That is if you
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The documentation is here:
http://www.wxpython.org/onlinedocs.php
In Alphabetical class reference you can find for example wxButton with
its methods. Yes - there is no function 'SetBackgroundColour'. But there
is a list with classes from which
On Thu, Feb 5, 2009 at 5:59 PM, rdmur...@bitdance.com wrote:
S.Selvam Siva s.selvams...@gmail.com wrote:
I tried to do a string replace as follows,
s=hi people
s.replace(,\)
'hi \\ people'
but i was expecting 'hi \ people'.I dont know ,what is something
different
here with
Ok,
I want to run a program called 'muscle' with my python script,
muscle uses the following command:
'muscle.exe -in filename -out filename'
so far I got:
import os
args = ['-in filename', '-out filename']
os.system('E:\Programs\muscle\muscle.exe args')
However, when I run this nothing
On Feb 4, 5:49 pm, andrew cooke and...@acooke.org wrote:
On Feb 4, 8:06 pm, len lsumn...@gmail.com wrote:
How does one find the methods that are available in the classes.
heh. welcome to the wonderful world of wxpython :o(
if you use eclipse to edit your code, then (providing the wind is
On Feb 4, 5:06 pm, len lsumn...@gmail.com wrote:
Hi
I am going through the wxPython in Action book by Noel Rappin and
Robin Dunn.
I have been typing in the example programs as I go and play with
modifing the code.
Thought I should start trying to find my way around the documentation
found
Brian Allen Vanderburg II wrote:
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
I think it may be just a 'little' more efficient to do this:
def flatten(x,
Youri Lammers schrieb:
Ok,
I want to run a program called 'muscle' with my python script,
muscle uses the following command:
'muscle.exe -in filename -out filename'
so far I got:
import os
args = ['-in filename', '-out filename']
os.system('E:\Programs\muscle\muscle.exe args')
Youri Lammers youri_lammers...@hotmail.com writes:
I want to run a program called 'muscle' with my python script=2C
muscle uses the following command:
'muscle.exe -in filename -out filename'
so far I got:
import os
args = ['-in filename', '-out filename']
less list creation.
On Thu, Feb 5, 2009 at 10:17 PM, mk mrk...@gmail.com wrote:
Brian Allen Vanderburg II wrote:
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return
Brian Allen Vanderburg II wrote:
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
I think it may be just a 'little' more efficient to do this:
def flatten(x, res=None):
These functions come from goopy:
def flatten1(seq):
Return a list with the contents of SEQ with sub-lists and tuples
exploded.
This is only done one-level deep.
lst = []
for x in seq:
if type(x) is list or type(x) is tuple:
for val in x:
lst.append(val)
else:
On 2009-02-05, Christian Heimes li...@cheimes.de wrote:
Youri Lammers schrieb:
Ok,
I want to run a program called 'muscle' with my python script,
muscle uses the following command:
'muscle.exe -in filename -out filename'
so far I got:
import os
args = ['-in filename', '-out
Hi!
I wanna ask that have anyone some exp. with Cheetah and the non-ascii chars?
I have a site. The html template documents are saved in ansi format, psp
liked them.
But the cheetah parser makes ParseError on hungarian characters, like
á, é, í, etc. When I remove them, I got good result, but
Thanks, Its working smoothly now
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 5, 1:17 pm, mk mrk...@gmail.com wrote:
Hello everybody,
Any better solution than this?
def flatten(x):
Just out of interest, how often do people really need
such a recursive flatten, as opposed to a single-level
version?
I often find myself needing a 'concat' method that
turns a list
Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr writes:
Gilles Ganault a écrit :
Hello
If I wanted to build some social web site such as Facebook, what do
frameworks like Django or TurboGears provide over writing a site from
scratch using Python?
Quite a lot of abstractions
Baolong zhen wrote:
less list creation.
At the cost of doing this at each 'flatten' call:
if res is None:
res = []
The number of situations of executing above code is the same as the
number of list creations (once for each 'flatten' call, obviously).
Is list creation really more costly
Matt Nordhoff wrote:
Tim H wrote:
On Win XP 64bit, Python 2.6.1 64bit
I am trying to rename files by their creation time.
It seems the time module is too smart for its own good here.
time.localtime(os.path.getctime(f)) returns a value one hour off
from what windows reports for files that
On Feb 5, 2:17 pm, mk mrk...@gmail.com wrote:
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3,
Mark Dickinson wrote:
On Feb 5, 1:18 am, Chris Rebert c...@rebertia.com wrote:
For an integer:
is_even = bin(the_int)[2:].count('1') % 2 == 0
But the OP has to use if and while. How about:
while 2+2 != 5:
if 'wkw' in 'just being awkward':
is_even = bin(the_int)[2:].count('1') %
durumdara schrieb:
Hi!
I wanna ask that have anyone some exp. with Cheetah and the non-ascii
chars?
I have a site. The html template documents are saved in ansi format, psp
liked them.
But the cheetah parser makes ParseError on hungarian characters, like
á, é, í, etc. When I remove them, I
mk wrote:
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]]
print flatten(a)
It
M.-A. Lemburg wrote:
On 2009-02-05 10:08, Nick Matzke wrote:
..., I can run this in the ipython shell just fine:
a = [12, 15, 16, 38.2]
dim = int(sqrt(size(a)))
...But if I move these commands to a function in another file, it freaks out:
You need to add:
from math import sqrt
or:
from
(duck)
542 comp.lang.python rtfm
467 comp.lang.python shut+up
263 comp.lang.perl rtfm
45 comp.lang.perl shut+up
Code:
import urllib2
import re
import time
def fillurlfmt(args):
urlfmt, ggroup, gkw = args
return {'group':ggroup, 'keyword':gkw, 'url': urlfmt % (gkw, ggroup)}
def
That page about Ruby dicts show a higher traversal speed (probably
just because the CPU has to scan less memory, but I am not sure,
because mordern CPUs are very complex) but lower insertion speed (I
think mostly not because the added management of two pointers, but
because the memory used
On Thu, Feb 5, 2009 at 11:00 AM, mk mrk...@gmail.com wrote:
(duck)
542 comp.lang.python rtfm
467 comp.lang.python shut+up
263 comp.lang.perl rtfm
45 comp.lang.perl shut+up
But over how many messages for each group? Wouldn't the percentage of
messages containing those be more
Now, I also do recognize the utility of ordered dictionaries in some cases,
but
exactly what you mean by ordered varies. I have two cases where ordered
has the keys are in a specific custom order. I have four cases where ordered
means maintaining insertion order. For the former I do
Mark Dickinson wrote:
I often find myself needing a 'concat' method that
turns a list of lists (or iterable of iterables) into
a single list; itertools.chain does this quite nicely.
But I don't think I've ever encountered a need for the
full recursive version.
You're most probably right in
Michele Simionato wrote:
Looks fine to me. In some situations you may also use hasattr(el,
'__iter__') instead of isinstance(el, list) (it depends if you want to
flatten generic iterables or only lists).
Thanks! Such stuff is what I'm looking for.
Regards,
mk
--
mrk...@gmail.com wrote:
Baolong zhen wrote:
less list creation.
At the cost of doing this at each 'flatten' call:
if res is None:
res = []
The number of situations of executing above code is the same as the
number of list creations (once for each 'flatten' call, obviously).
Is list
2009/2/5 mk mrk...@gmail.com:
(duck)
542 comp.lang.python rtfm
467 comp.lang.python shut+up
263 comp.lang.perl rtfm
45 comp.lang.perl shut+up
Yes, but is there any real traffic on comp.lang.perl nowadays?
Sorry, cheap shot ;-)
--
Tim Rowe
--
Tim Rowe a écrit :
2009/2/4 Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr:
# somemodule.py
import os
if os.uname()[0] == Linux:
On an MS Windows system, os.uname()[0] raises an AttributeError
Thanks for the correction - as you may have guessed, I have not used
windows for
Paul Rubin wrote:
bearophileh...@lycos.com writes:
Now Ruby dicts are ordered by default:
http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/
Maybe I didn't read that carefully enough, but it looks like ordered
means the dict records come out in the same order you inserted them
The subprocess module was added in Python 2.4. I'm running 2.4.5 at work.
I know it's seen many bugfixes since first released. Is the version in 2.4
robust enough to use in preference to os.popen and friends?
Thx,
--
Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/
--
mk schrieb:
(duck)
542 comp.lang.python rtfm
467 comp.lang.python shut+up
263 comp.lang.perl rtfm
45 comp.lang.perl shut+up
It appears to me that comp.lang.perl isn't even active anymore. Or
googles interface is just crappy.
c.l.perl.misc seems to be the place to search.
And raw
Brian Allen Vanderburg II wrote:
Is list creation really more costly than above?
Probably not. I wrote a small test program using a list several levels
deep, each list containing 5 sublists at each level and finally just a
list of numbers. Flattening 1000 times took about 3.9 seconds for
Either list creation is somewhat
costly, or if var is None is really cheap.
if x is y is extremely cheap, I believe. Unlike most comparisons
which are (relatively) expensive, that one is just comparing simple
object address. You can't override is so there's a whole series of
checks that don't
Baolong zhen netz...@gmail.com wrote:
On Thu, Feb 5, 2009 at 10:17 PM, mk mrk...@gmail.com wrote:
Brian Allen Vanderburg II wrote:
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
mk mrk...@gmail.com writes:
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3, [4, 5, 6], [[7, 8], [9,
mk mrk...@gmail.com wrote:
Brian Allen Vanderburg II wrote:
I think it may be just a 'little' more efficient to do this:
def flatten(x, res=None):
if res is None:
res = []
for el in x:
if isinstance(el, (tuple, list)):
flatten(el, res)
else:
En Thu, 05 Feb 2009 04:48:13 -0200, Spacebar265 spacebar...@gmail.com
escribió:
Hi. Does anyone know how to scan a file character by character and
have each character so I can put it into a variable. I am attempting
to make a chatbot and need this to read the saved input to look for
spelling
En Wed, 04 Feb 2009 21:12:58 -0200, andrew cooke and...@acooke.org
escribió:
On Feb 4, 7:49 pm, andrew cooke and...@acooke.org wrote:
This leads to a circular dependency - the base class wants to import
the components, which in turn want to import the base class.
well, to partially answer my
Does anyone know of a HOWTO for setting up a PyQt project in Eclipse ?
I know about setting up a PyDev project, just wondering how to integrate
the QtDesigner parts.
For example, should I save the QtDesigner project in the root PyDev
directory ?
Thanks
--
En Sun, 01 Feb 2009 18:00:36 -0200, Andrew Parker gbofs...@gmail.com
escribió:
On Sun, Feb 1, 2009 at 1:46 PM, Andrew Parker gbofs...@gmail.com wrote:
I'm having some fun with Popen. I have the following line:
process = subprocess.Popen(command, stdout=subprocess.PIPE,
(duck)
542 comp.lang.python rtfm
467 comp.lang.python shut+up
263 comp.lang.perl rtfm
45 comp.lang.perl shut+up
Is this where we tell you to shut up? gdr ;-)
As others mentioned, the raw numbers don't mean much without a
total-volume-of-posts to demonstrate the percentage.
It would also be
Quoth rdmur...@bitdance.com:
This is all premature optimization, except for the goopy code, which is
presumably used enough to make it worth optimizing. And guess what?
The goopy code wins. What the people theorizing about the speed of
extend vs list creation miss is that the things with
En Mon, 02 Feb 2009 10:10:15 -0200, Alessandro Zivelonghi
zasaconsult...@gmail.com escribió:
*Ntop = odb.rootAssembly.instances['PART-1-1'].nodeSets['TOP'].nodes
*
Problem:
1) the list of nodes Ntop contains all the node labels [2673, 2675,
2676, 2677, 2678, 3655, 3656, 119939,
1 - 100 of 277 matches
Mail list logo