Em Ter, 2006-08-01 às 18:45 -0700, jeremito escreveu:
> I am extending python with C++ and need some help. I would like to
> convert a string to a mathematical function and then make this a C++
> function.
I may be wrong, but I don't think you can create new C++ functions
on-the-fly. At least I
20 Aug 2006 14:47:14 -0700, Bucco <[EMAIL PROTECTED]>:
> I am trying to compare a list of items to the list of files generated
> by os.listdir. I am having trouble getting this to work and think I
> may be going down the wrong path. Please let me know if hter is a
> better way to do this. THis i
22 Oct 2006 06:33:50 -0700, Lucas <[EMAIL PROTECTED]>:
I known how to do it.read() return a string. so1) bytes = read(1) #read the file by bit.2) chrString = ord(bytes) #convert the string to ASCII.3) print numberToBinary(chrString) #convert the ASCII to Binary using
my function.4) Loop[numberToBi
29 Oct 2006 14:18:02 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid>:
> "Nick Vatamaniuc" <[EMAIL PROTECTED]> writes:
> > The simplest solution is to change your system and put the DB on the
> > same machine thus greatly reducing the time it takes for each DB query
> > to complete (avoid the TCP
Em Sex, 2006-06-02 às 15:42 -0500, Larry Bates escreveu:
> ReportLab Graphics can do 2D and pie charts, but I don't think it does
> 3D charts yet.
>
> www.reporlab.org
It does, but I'm not sure if the PNG backend is as good as the PDF one.
--
Felipe.
--
http://mail.python.org/mailman/listinfo
Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu:
> I can't browse to www.reporlab.org, but I found http://www.reportlab.com/
> which has a commercial charting product. Is that what you referring to?
ReportLab (the commercial bussiness thing on .com) is where the main
developers of ReportLab (a l
Em Ter, 2006-06-06 às 13:56 +, Paul McGuire escreveu:
> (just can't open it up like a text file)
Who'll open a 10 GiB file anyway?
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-list
Em Sex, 2006-06-09 às 12:30 -0400, Alan Isaac escreveu:
> It's your code, so you get to license it.
> But if you wish to solicit patches,
> a more Pythonic license is IMHO more likely
> to prove fruitful.
"Pythonic license"? That's new to me. I can figure out what a
"Python-like license" is, but I
Em Sex, 2006-06-09 às 13:54 -0700, Manish Marathe escreveu:
> On 6/9/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Manish Marathe wrote:
>
> > I am creating threads using my self defined class which
> inherits the
> > threading.Thread class. I want to know
Em Dom, 2006-06-11 às 11:19 -0700, fl1p-fl0p escreveu:
> import math
> math.pow(34564323, 456356)
>
> will give math range error.
>
> how can i force python to process huge integers without math range
> error? Any modules i can use possibly?
34564323**456356 ?
--
Felipe.
--
http://mail.pytho
Em Dom, 2006-06-11 às 20:10 +, Stan Cook escreveu:
> Can anyone tell me how to get the length of a number. I
> know len(string) will get the length of a string, but it
> doesn't like len(int). I seem to remember something like %s
> string. I tried to set a variable = to %s int, but that
Em Dom, 2006-06-11 às 13:17 -0700, Saketh escreveu:
> Stan Cook wrote:
> > Can anyone tell me how to get the length of a number. I
> > know len(string) will get the length of a string, but it
> > doesn't like len(int). I seem to remember something like %s
> > string. I tried to set a variable =
Em Dom, 2006-06-11 às 22:33 +0200, Sybren Stuvel escreveu:
> Felipe Almeida Lessa enlightened us with:
> > To see how many decimal digits it has:
> >
> > import math
> > math.ceil(math.log(i, 10))
>
> That doesn't work properly.
>
> >&g
23 Aug 2006 17:28:48 -0700, KraftDiner <[EMAIL PROTECTED]>:
> This is obvious... but how do I crop off the high order bits if
> necessary?
> a[0]&0x ?
min(a[0], 0x) ?
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-list
2006/8/30, Ben Finney <[EMAIL PROTECTED]>:
> re
> struct
> unicodedata
> decimal
> random
> logging
> Queue
> urlparse
> email
operator
cStringIO
math
cmath
sets (merged to the language)
itertools
os + stat
time
tempfile
glob
Not that I use them all the time, b
2006/8/30, Les Schaffer <[EMAIL PROTECTED]>:
> is there a best practice way to do this?
I'm not a cryptographer, but you should really try the function
collect() inside the gc module.
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-list
2006/9/3, Alex Martelli <[EMAIL PROTECTED]>:
> Reflecting on the OP's use case, since all connections are forever being
> made to the same 16 servers, why not tweak thinks a bit to hold those
> connections open for longer periods of time, using a connection for many
> send/receive "transactions" in
4 Sep 2006 19:19:24 -0700, Sandra-24 <[EMAIL PROTECTED]>:
> If there was a mod_dotnet I wouldn't be using
> CPython anymore.
I guess you won't be using then: http://www.mono-project.com/Mod_mono
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-list
5 Sep 2006 03:44:47 -0700, Leon <[EMAIL PROTECTED]>:
> Greetings,
>
> Does anybody know of or is working on any python modules that allow for
> a direct but higher-level interface to OpenGL? For example, quick
> functions to draw lines, curves, and basic shapes; define hsb color
> mode; fill and st
2006/9/7, Bruno Desthuilliers <[EMAIL PROTECTED]>:
> I don't think one could pretend writing a cross-platform application
> without testing it on all targeted platforms.
E.g: while creating a free software, you may not have an Apple
computer but you may want to be *possible* to run your program th
2006/9/5, Jim Hugunin <[EMAIL PROTECTED]>:
> I'm extremely happy to announce that we have released IronPython 1.0 today!
> http://www.codeplex.com/IronPython
Does IronPython runs Twisted?
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-list
7 Sep 2006 16:34:56 -0700, Luis M. González <[EMAIL PROTECTED]>:
> People are already porting some of these libraries.
> Those that are written in pure python don't need to be ported, but
> those that rely on c extensions can be rewritten in c# or any other
> .NET language.
Or in C that is P/Invok
2006/9/7, Butternut Squash <[EMAIL PROTECTED]>:
> right now we are using c# and .net remoting in a way that just is not
> efficient.
>
> I want to rewrite a lot of what we do in python. I have seen XML-RPC and
> soap. Are there other options?
It surely depends on what's going to be on the other s
8 Sep 2006 13:41:48 -0700, Jay <[EMAIL PROTECTED]>:
> Let's say, for instance, that one was programming a spell checker or
> some other function where the contents of a string from a text-editor's
> text box needed to be split so that the resulting array has each word
> as an element. Is there a s
2006/9/8, Butternut Squash <[EMAIL PROTECTED]>:
> I have to support multiple applications using different schema and
> databases. Would like to present as much as a unified interface as
> possible.
I'd recomend CORBA as it supports multiple platforms and languages.
SOAP and XML-RPC can be used as
8 Sep 2006 17:37:02 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> 1. Using an _ is an interesting way to use a throw-away variable. Never
> would I think of that ... but, then, I don't do Perl either :)
It's a kind of convention. For example, Pylint complains for all
variables you set and don't
08 Sep 2006 17:33:20 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid>:
> [EMAIL PROTECTED] writes:
> > print sum( ([i]*n for i,n in enumerate(seq)), [])
>
> Wow, I had no idea you could do that. After all the discussion about
> summing strings, I'm astonished.
Why? You already had the answer: s
2006/9/6, Robin Becker <[EMAIL PROTECTED]>:
> enigmadude wrote:
> > As many have heard, IronPython 1.0 was released. When I was looking
> > through the listed differences between CPython and IronPython, the
> > document mentioned that using large exponents such as 10 **
> > 735293857239475 will cau
10 Sep 2006 16:17:08 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid>:
> So, I think it's not worth thinking about writing yet another BBS
> unless it can handle a Slashdot-sized load on a commodity PC.
Python is slow. Psyco helps, but you should use C instead.
And yes, I am kidding =)
--
Fel
7 Sep 2006 23:38:08 -0700, Tal Einat <[EMAIL PROTECTED]>:
> > I'm not an expert in socket programming, but I can't see the
> > correlation between the "listener socket" being in timeout mode and a
> > different behavior the other sockets..
> > Anyhow the main goal is being able to shut down the thr
2006/9/21, Berthold Höllmann <[EMAIL PROTECTED]>:
> Saving the following code to a file and running the code through
> python does not give the expected error. disableling the "@decor" line
> leads to the expected error message. Is this a bug or an overseen
> feature?
Try the new_decor class descr
24 Sep 2006 10:09:16 -0700, Rainy <[EMAIL PROTECTED]>:
> Functionally they are the same, but third line included in Firefox.
> Opera View Source command produces the same result as Python.
[snip]
It's better to compare with the result of a downloader-only (instead
of a parser), like wget on Unix.
2006/9/25, Robert Kern <[EMAIL PROTECTED]>:
> walterbyrd wrote:
> > If so, I doubt there are many.
> >
> > I wonder why that is?
>
> Well I do. So do the other dozen or so developers at my company. We're looking
> to hire a few more, in fact.
And there are also those ReportLab guys:
www.reportlab
2006/9/26, Sybren Stuvel <[EMAIL PROTECTED]>:
> Aahz enlightened us with:
> > Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> >>
> >>well, if you're only watching mtv, it's easy to think that there's
> >>obviously not much demand for country singers, blues musicians,
> >>British hard rock bands, or mel
28 Sep 2006 19:07:23 -0700, Larry Hastings <[EMAIL PROTECTED]>:
> THE BENCHMARKS
>
> Benchmark 1:
> def add(a, b, c, ... t): return a + b + c + ... + t
> for i in range(1000): add("aaa", "bbb", "ccc", ..., "ttt")
[snip]
What about "a + b"? Or "a + b + c"? Does it have a large o
On 12/1/06, Karl Kofnarson <[EMAIL PROTECTED]> wrote:
[snip]
> def fun_basket(f):
> common_var = [0]
> def f1():
> print common_var[0]
> common_var[0]=1
> def f2():
> print common_var[0]
> common_var[0]=2
> if f == 1:
> return f1
> if f ==
On 2 Dec 2006 10:42:28 -0800, Evan <[EMAIL PROTECTED]> wrote:
> Why is it that the first call works fine, but the second tells me
> 'global name 'self' is not defined'? What I want is to have the
> dictionary 'estoc' available in my calling script.
Well, you have not posted the code that is causi
On 4 Dec 2006 20:18:22 -0800, Linan <[EMAIL PROTECTED]> wrote:
> 3, If not, where to get the real one(s)?
After reading Calvin's mail, you may want to see
http://twistedmatrix.com/ . It's an assynchronous library built around
the concept of deferreds (think of callbacks). You may like it =).
Cya,
On 26 Dec 2006 04:22:38 -0800, placid <[EMAIL PROTECTED]> wrote:
> So do you want to remove "&" or replace them with "&" ? If you want
> to replace it try the following;
I think he wants to replace them, but just the invalid ones. I.e.,
This & this & that
would become
This & this & that
No, i
On 31 Dec 2006 03:57:04 -0800, Isaac Rodriguez
<[EMAIL PROTECTED]> wrote:
> I am using Python 2.4, and I was wondering if by default, all
> classes are assumed to be derived from "object".
This won't tell you advantages or disadvantages, but will show you
that the default still is the old-style:
On 31 Dec 2006 05:20:10 -0800, JTree <[EMAIL PROTECTED]> wrote:
> def funUrlFetch(url):
> lambda url:urllib.urlopen(url).read()
This function only creates a lambda function (that is not used or
assigned anywhere), nothing more, nothing less. Thus, it returns None
(sort of "void") no matter wha
On 3 Jan 2007 10:52:02 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> I have tried to
> convert them to tex using OpenOffice, but the result is ugly as hell.
Why not use OO.org to convert DOC to PDF? It does so natively, IIRC.
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-
On 1/3/07, meelab <[EMAIL PROTECTED]> wrote:
> I am looking for a way to create a "static object" or a "static class" -
> terms might be inappropriate - having for instance:
An example will speak better than me:
class Card(object):
__cards = {}
def __init__(self, number, suit):
s
On 1/4/07, Chaz Ginger <[EMAIL PROTECTED]> wrote:
> I have a rather large Python/Twisted Matrix application that will be run
> on Windows, Linux and perhaps Macs. I was wondering if there are any
> tools that can be used to create an installer that will bring in Python,
> Twisted Matrix, my applica
On 07 Jan 2007 02:01:44 -0800, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> > __ (two leading underscores) results in name-mangling. This /may/ be
> > used to specify "private" data, but is really more useful when one is
> > designing wi
On 1/7/07, Michael M. <[EMAIL PROTECTED]> wrote:
> How to find the longst element list of lists?
s1 = ["q", "e", "d"]
s2 = ["a", "b"]
s3 = ["a", "b", "c", "d"]
s = [s1, s2, s3]
s.sort(key=len, reverse=True)
print s[0] is s3
print s[1] is s1
print s[2] is s2
sx1, sx2, sx3 = s
print 'sx1:', sx1
pr
On 1/8/07, tsuraan <[EMAIL PROTECTED]> wrote:
[snip]
> The loop is deep enough that I always interrupt it once python's size is
> around 250 MB. Once the gc.collect() call is finished, python's size has
> not changed a bit.
[snip]
> This has been tried under python 2.4.3 in gentoo linux and python
On 1/8/07, tsuraan <[EMAIL PROTECTED]> wrote:
>
>
> > I just tried on my system
> >
> > (Python is using 2.9 MiB)
> > >>> a = ['a' * (1 << 20) for i in xrange(300)]
> > (Python is using 304.1 MiB)
> > >>> del a
> > (Python is using 2.9 MiB -- as before)
> >
> > And I didn't even need to tell the ga
On 9 Jan 2007 07:01:31 -0800, abcd <[EMAIL PROTECTED]> wrote:
> anyways, is there a way to check without having an instance of the
> class?
In [1]: class A:
...: pass
...:
In [2]: class B(A):
...: pass
...:
In [3]: issubclass(B, A)
Out[3]: True
In [4]: isinstance(B(), B)
Out
Em Sáb, 2006-02-11 às 12:04 -0800, mwt escreveu:
> I'm doing some python programming for a linux terminal (just learning).
> When I want to completely redraw the screen, I've been using
> os.system("clear")
> This command works when using python in terminal mode, and in IDLE.
> However, when runnin
Em Sáb, 2006-02-11 às 14:52 -0500, John Salerno escreveu:
> Hi all. I'm just starting out with Python, so I'm a little slow right
> now. :)
>
> Can someone explain to me why the expression 5 / -2 evaluates to -3,
> especially considering that -2 * -3 evaluates to 6?
>
> I'm sure it has somethin
Hi,
IMHO, on http://www.python.org/doc/current/lib/itertools-example.html ,
shouldn't the part
>>> for k, g in groupby(enumerate(data), lambda (i,x):i-x):
... print map(operator.itemgetter(1), g)
be
>>> for k, g in groupby(enumerate(data), lambda (i, x): i-x):
... print [i[1] for i in g
Em Sáb, 2006-02-11 às 20:16 -0800, Raymond Hettinger escreveu:
> Both work just fine. It's a personal choice when to use map() and when
> to use a list comprehension. Since many itertools have the flavor of
> map/filter, its use is not out of place in the itertools docs.
I know both work in the
Em Dom, 2006-02-12 às 03:03 -0800, [EMAIL PROTECTED] escreveu:
> Probably every answer I can give you is wrong for you, so answering is
> almost useless... In this thread we have already given the most
> pertinent answers to the original question from Diffuse.
> I can show you this page, but I thin
Em Dom, 2006-02-12 às 03:20 -0800, [EMAIL PROTECTED] escreveu:
> However, to me, the strength of python is the batteries that is
> included(and there are more and more coming).
So .NET is as good as Python? Hmmm... I think the language itself is the
best part of Python, its library is just a compl
Em Dom, 2006-02-12 às 04:33 -0800, [EMAIL PROTECTED] escreveu:
> Felipe Almeida Lessa wrote:
> > Em Dom, 2006-02-12 às 03:20 -0800, [EMAIL PROTECTED] escreveu:
> > > However, to me, the strength of python is the batteries that is
> > > included(and there are more and mo
Em Dom, 2006-02-12 às 05:11 -0800, MKoool escreveu:
> I have an application with one function called "compute", which given a
> filename, goes through that file and performs various statistical
> analyses. It uses arrays extensively and loops alot. it prints the
> results of it's statistical sign
Em Dom, 2006-02-12 às 22:11 +, HappyHippy escreveu:
> More of a minor niggle than anything but how would I remove the
> aforementioned space?
>
> eg.
> strName = 'World'
> print 'Hello', strName, ', how are you today?'
>
> comes out as "Hello World , how are you today?"
strname = 'World'
pr
Em Dom, 2006-02-12 às 20:10 -0500, Steve Holden escreveu:
> I'd like the questions to be representative of as broad a cross-section
> of the Python community as possible. If you have a question you'd like
> to hear Bram answer please let me know and I'll try to include them.
Something I think lo
Em Dom, 2006-02-12 às 23:15 -0500, Steve Holden escreveu:
> Given that Python 2.4 doesn't even perform simple constant folding for
> arithmetic expressions
> [snip]
May I ask why doesn't it perform such optimization? Is there any special
difficulties in doing so with the Python compiler?
Also, I
Em Dom, 2006-02-12 às 23:51 -0500, Steve Holden escreveu:
> The basic answer is that so far no developer has felt it worthwhile to
> expend time on adding these optimizations.
I always thought these small optimizations could lead Python to be
faster overall. I remember about this every time I see
Em Ter, 2006-02-14 às 10:08 +0100, bruno at modulix escreveu:
> for item in reversed(alist):
> do_something_with(item)
>
> or (more perlish at first sight):
>
> for item in alist[::-1]:
> do_something_with(item)
No "or" here. The [::-1] version creates a whole new list in memory,
it's silly
Em Qua, 2006-02-15 às 00:30 +, LittlePython escreveu:
> I really do not wish to limit myself to MS. My bread and butter is MS but I
> am a BSD fan at heart. I wanted to learn something I can use in both.
Please start by not top-posting ;-). Also, see
http://www.mono-project.com/VisualBasic.NET
Em Ter, 2006-02-14 às 19:54 -0500, Ken Stevens escreveu:
> Some people or group of people decided bottom posting was better and it
> MUST be that way. To me that even goes against one of the main
> philosophies of Linux which is that of choice. So, to any who think,
> otherwise... there is absol
Em Ter, 2006-02-14 às 17:32 -0800, Jonathan Gardner escreveu:
> So, one more story on why Python is really good. I think, at least with
> 2.4, we should start bragging about Python's speed. I mean, it beats
> Java AND perl!
Maybe the other implementations also have errors? Well, I'm not saying
Pyt
Em Ter, 2006-02-14 às 20:14 -0800, Farel escreveu:
> Which is Faster in Python and Why?
>
> jc = {}; m = []
> x = [ [1,2,3,4,5,6,7,8,9],[..],...] # upwards of 1 entries
> def binm()
> for item in x:
> b = item[:]; b.sort(); bc = 0
> for bitem in b: bc += int(bitem)
>
Em Sáb, 2006-02-18 às 04:24 -0800, Fuzzyman escreveu:
> It is set to expire on the 22nd May, and displays a nag screen on
> startup. Other than that, it is the full version. Have fun.
Attached is the cracked version with no expiration limit and my own
bitmap on the startup. Enjoy!
> Fuzzyman
> ht
Em Sáb, 2006-02-18 às 14:38 +0200, Max escreveu:
> On monday I start a semester course in Python (the alternative was
> Java). I was looking through the course outline and noticed the following:
>
> 1) UserDict is used. This is deprecated, right?
LOL... it's the first time I see someone talking
Em Sáb, 2006-02-18 às 17:42 +0100, K. Jansma escreveu:
> How can I avoid this without using eg. self.L in an __init__?
Why not use it? That's how it's meant to be done!
> Thanks in advance,
> Karel.
Cya,
Felipe.
--
"Quem excele em empregar a força militar subjulga os exércitos dos
outros povos
Em Sáb, 2006-02-18 às 16:50 +, Duncan Booth escreveu:
> marker = object()
>
> class Test(object):
> def __init__(self):
> self.L = []
>
> def f(self,a, L=marker):
> if L is marker:
> L = self.L
> L.append(a)
> return L
As hasattr(None, "ap
Em Sáb, 2006-02-18 às 20:04 +, Jeffrey Schwab escreveu:
> if __name__ == '__main__':
> loop = Loop(10)
> while loop:
> print "OK"
Maybe:
while Loop(10)():
print "OK"
Looks rather ugly but requires one less line ;-).
--
"Quem excele em empregar a força mili
Em Dom, 2006-02-19 às 11:08 +1100, Nigel Rowe escreveu:
> Felipe Almeida Lessa wrote:
>
> > Em Sáb, 2006-02-18 às 20:04 +, Jeffrey Schwab escreveu:
> >> if __name__ == '__main__':
> >> loop = Loop(10)
> >> while loop:
> >>
Em Sáb, 2006-02-18 às 15:13 +0200, Max escreveu:
> > I wonder if they need some updating.
> >
>
> And so does Dive Into Python (our textbook, diveintopython.org) which
> has the same deficiencies in its outline.
Are they being *paid* for teaching? Then they should overcome this issue
of Dive In
Em Seg, 2006-02-20 às 17:01 -0500, Roy Smith escreveu:
> In article <[EMAIL PROTECTED]>,
> "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> > def fact(n):
> > res = 1
> > while n != 0:
> > res *= n
> > n -= 1
> > return res
> >
> > fact(-1)
>
> Could be worse. You could have written:
>
Em Qua, 2006-02-22 às 21:38 +0100, Gerhard Häring escreveu:
> A Tkinter hello weights here 1,95 MB (2.049.264 Bytes)
>
> compared to the small wxPython tool that I compressed recently: 2,80 MB
> (2.942.543 Bytes)
What about PyGtk? Does anybody have any figures? I can't test here =(...
--
"Quem
Em Qui, 2006-02-23 às 15:26 -0600, Paul Probert escreveu:
>My app runs in a loop looking for changes in a database, and like a
> good boy I call time.sleep(1) inside the loop. Unfortunately this
> sometimes runs for 200 seconds or so, presumably while my OS is calling
> Bill Gates to tell hi
Em Sáb, 2006-02-25 às 09:14 -0500, Steve Holden escreveu:
> It seems particularly odd to want to put getters and setters behind
> property access. What does the extra layer buy you?
I can only think of some kind of debugging. Maybe?
> regards
> Steve
Cya,
Felipe.
--
"Quem excele em empregar
Em Sáb, 2006-02-25 às 17:56 -0800, [EMAIL PROTECTED] escreveu:
> Steve Holden wrote:
> > > Some other functions rely on the AssertionError exception to indicate to
> > > the user that something went wrong instead of using a user defined
> > > exception.
> > >
> >
> > The real problem here is that y
Em Seg, 2006-02-27 às 00:43 -0800, Paul Rubin escreveu:
> def print_members(header, e): # print header, then members of enum e
> print header
> for m in e:
> print '\t', str(m)
>
> months_longer_than_february = enum('jan', 'mar', 'apr', ) # etc
> months_shorter_tha
Em Seg, 2006-02-27 às 02:42 -0800, Paul Rubin escreveu:
> Felipe Almeida Lessa <[EMAIL PROTECTED]> writes:
> > IMHO, you should be using sets, not enums. Something like:
>
> If enums aren't supposed to work in that construction then the PEP
> shouldn't specify th
Em Ter, 2006-02-28 às 20:24 +, Grant Edwards escreveu:
> > I have seen examples that used classes, and other examples
> > that just called one thread start command - when should you
> > use one over another?
>
> I'm not sure what you mean by "use classes" vs. "calling a
> thread start command"
Em Ter, 2006-02-28 às 09:10 -0800, [EMAIL PROTECTED] escreveu:
> Although I don't know if this is faster or more efficient than your
> current solution, it does look cooler:
[snip]
> print [x for x in grouper]
This is not cool. Do
print list(grouper)
--
"Quem excele em empregar a força militar
Em Ter, 2006-02-28 às 20:38 +, Grant Edwards escreveu:
> On 2006-02-28, D <[EMAIL PROTECTED]> wrote:
>
> > Thanks, Grant. I apologize for not being clear on what I
> > meant by using "classes". This is an example of what I was
> > referring to:
> > http://www.wellho.net/solutions/python-pyth
Em Ter, 2006-02-28 às 15:17 -0500, Nicolas Fleury escreveu:
> class A:
> @staticmethod
> def foo(): pass
> bar = foo()
# Why not:
def foo(): pass
class A:
bar = foo()
foo = staticmethod(foo)
--
"Quem excele em empregar a força militar subjulga os exércitos dos
ou
Em Ter, 2006-02-28 às 17:47 -0500, [EMAIL PROTECTED] escreveu:
> Quoting Derek Basch <[EMAIL PROTECTED]>:
>
> > Given a value (x) that is within the range (1e-1, 1e7) how do I round
> > (x) up to the closest exact logarithmic decade? For instance:
>
> How about this:
>
> def roundup(x):
> if
Em Seg, 2006-02-27 às 17:10 -0800, Paul Rubin escreveu:
> Ben Finney <[EMAIL PROTECTED]> writes:
> > If an enumeration object were to be derived from, I would think it
> > just as likely to want to have *fewer* values in the derived
> > enumeration. Subclassing would not appear to offer a simple wa
Em Sex, 2006-03-03 às 10:26 +0100, Blackbird escreveu:
> However, range(10) in the command interpreter obviously returns a list. Is
> this list optimized away in the code above, or is it actually constructed
> internally? (With, say, CPython in one of the recent versions.)
It's constructed. That'
Em Sex, 2006-03-03 às 12:48 +, William Meyer escreveu:
> Kent Johnson kentsjohnson.com> writes:
>
> > In either case enumerate() is your friend. To find an
> > item by identity:
> >
> > def index_by_id(lst, o):
> >for i, item in enumerate(lst):
> > if item is o:
> >return i
Em Dom, 2006-03-05 às 11:49 +, Sandro Dentella escreveu:
> class foo(object):
>
> def __init__(self):
> print "a: ", a
> # += does not work if 'a' is global
> #a += [1]
> a.append(2)
> print "a= ", a
Try with:
a = [0]
class foo(object):
def
On 3/23/07, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> (Note that almost everything in Python is an object!)
Could you tell me what in Python isn't an object? Are you counting
old-style classes and instances as "not object"s?
--
Felipe.
--
http://mail.python.org/mailman/listinfo/python-li
On 24 Mar 2007 20:24:36 -0700, 7stud <[EMAIL PROTECTED]> wrote:
> Here is some example code that produces an error:
[snip]
Why do people absolutely *love* to do weird and ugly things with
Python? Contests apart, I don't see lots of people trying this kind of
things on other (common) languages.
Sa
On 1/10/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> At Wednesday 10/1/2007 04:38, Paul Sijben wrote:
> >Does anyone know what it going on here and how I can ensure that I have
> >all the threads I need?
>
> Simply you can't, as you can't have 1 open files at once.
> Computer resources ar
On 1/10/07, Laurent Pointal <[EMAIL PROTECTED]> wrote:
This is a system configurable limit (up to a maximum).
See ulimit man pages.
test
ulimit -a
to see what are the current limits, and try with
ulimit -u 2000
to modify the maximum number of user process (AFAIK each thread
On 7 Feb 2007 19:14:13 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> struct module pack and unpack will only work for fixed size buffer :
> pack('>1024sIL', buffer, count. offset) but the buffer size can vary
> from one packet to the next :-(
Then send the size of the buffer before the buffer, s
On 2/19/07, Steven W. Orr <[EMAIL PROTECTED]> wrote:
> The short story is that someone left, but before he left he checked in a
> .pyc and then both the directory was destroyed and the backups all got
> shredded (don't ask*). Is there anything that can be extracted? I looked
> on the web and the su
Em Ter, 2006-04-18 às 10:31 -0500, Tim Chase escreveu:
> Is there an obvious/pythonic way to remove duplicates from a
> list (resulting order doesn't matter, or can be sorted
> postfacto)? My first-pass hack was something of the form
>
> >>> myList = [3,1,4,1,5,9,2,6,5,3,5]
> >>> uniq = dict(
Em Ter, 2006-04-18 às 17:25 -0700, [EMAIL PROTECTED] escreveu:
> Hi,
> I have a bunch of strings like
> a53bc_531.txt
> a53bc_2285.txt
> ...
> a53bc_359.txt
>
> and I want to extract the numbers 531, 2285, ...,359.
Some ways:
1) Regular expressions, as you said:
>>> from re import compile
>>> fi
Em Qua, 2006-04-19 às 16:54 -0700, mwt escreveu:
> This works when I try it, but I feel vaguely uneasy about putting
> method calls in exception blocks.
What do you put in exception blocks?!
> So tell me, Brave Pythoneers, is this
> evil sorcery that I will end up regretting, or is it just plai
Em Sex, 2006-04-21 às 13:49 -0400, Michael Yanowitz escreveu:
>I ran the new pylint and my code and I had a few questions on why those
> are warnings or what I can do to fix them:
You can ignore the warnings you don't like with the --disable-msg
option. Also, you can add a header to the file t
Em Sex, 2006-04-21 às 18:40 -0700, Clodoaldo Pinto escreveu:
> Only a small problem when I try to evaluate this:
>
> safe_eval('True')
Change
def visitName(self,node, **kw):
raise Unsafe_Source_Error("Strings must be quoted",
node.name, node)
To
1 - 100 of 210 matches
Mail list logo