ring it to a crawl. I
haven't figured out a strategy for trying to address that yet, and
ultimately, I may not find one. That's okay: perfection isn't my goal,
infinite loops are easy enough to do on accident that halting them is
important.
--
Stephen Hansen
... Also: Ixoka
On 8/14/10 8:11 PM, geremy condra wrote:
> cpulimit or a cgroups container can both be easy solutions here,
> depending on your exact needs.
Hmm! I wasn't aware of those, I'll check that out. Thanks.
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python
On 8/16/10 7:01 AM, Roland Koebler wrote:
> On Sat, Aug 14, 2010 at 08:01:00PM -0700, Stephen Hansen wrote:
>>> As you can see, black listing isn't the best approach here.
>>
>> But I have a two pronged strategy: the black list is only half of the
>> equation.
On 8/21/10 5:56 PM, Gregory Ewing wrote:
> Stephen Hansen wrote:
>
>> Me, I'm going to go farther on my own installation and kill import
>> entirely, and do a sort of require() which returns a special proxied
>> version of an imported module
>
> Note that you
On Fri, Jun 5, 2009 at 6:56 PM, Robert Dailey wrote:
> Is it possible to create an object in Python that will clean itself up
> at function exit? I realize destruction of objects may not occur
> immediately and can be garbage collected, but this functionality would
> still be great to have. Consi
On Mon, Jun 8, 2009 at 2:36 PM, wrote:
> Is there any reason to prefer one or the other of these statements?
>
>if e.message.code in [25401,25402,25408]:
>if e.message.code in (25401,25402,25408):
>
> I'm currently using [], but only coz I think it's prettier
> than ().
I like t
>
> private_hash = dict( A=42, B=69 )
> def public_fn(param):
>return private_hash[param]
> print public_fn("A") # good: prints 42
> x = private_hash["A"]# works: oops, hash is in scope
>
> I'm not happy with that because I'd like to limit the scope of the
> private_hash variable s
> Suppose I have 2 functions like so:
>
> def Function2( **extra ):
> # do stuff
>
> def Function1( **extra ):
> Function2( extra )
>
> As you can see, I would like to forward the additional keyword
> arguments in variable 'extra' to Function2 from Function1. How can I
> do this? I'm using Pyth
>
>
>1. Anyone knows whet's the limitation on cStringIO.StringIO() objects ?
>2. Could you suggest a better way to create a string that contains the
>concatenation of several big files ?
>
>
This isn't a limit in cStringIO.StringIO, but a limit on the amount of
memory a process is able
>
> In the attached http://www.nabble.com/file/p24726902/test.py test.py
> code,
> it appears that additional statements execute after the call to
> sys.exit(0).
> I'll be grateful if anyone can shed light on why this is happening. Below
> is a copy of some sample I/O. Note that in the last case
>
>
> # Here is something different:
> >>> (0 or None) == (None or 0)
> False
What is the actual problem? You quoted the docs, it seems very clear.
(0 or None) would return None.
(None or 0) would return 0.
None is not equal to 0, of course.
--S
--
http://mail.python.org/mailman/listinfo/pyt
output += '\nKnown topics: %s' % (', '.join(str(self.topics)))
Your problem is here.
self.topics is a list of topic instances: but you're calling str() on the
list itself to turn the LIST itself into a string. Compare:
>>> x = [1,2,3]
>>> x
[1, 2, 3]
>>> str(x)
'[1, 2, 3]'
Now, after str(se
>
> only the first topic is printed. If topics only contain a single topic I
> get this error:
> Traceback (most recent call last):
> File "C:\Users\fencer\workspace\Find Expert\src\find_expert.py", line 57,
> in
>print experts[1]
> File "C:\Users\fencer\workspace\Find Expert\src\find_expert
>
> Could you explain or link me to an explanation of this? Been using
> Python for a while but not sure I understand what's happening below.
> Thanks.
>
> >>> ss=1 and "f"
> >>> ss
> 'f'
> >>> ss=0 and "f"
> >>> ss
> 0
> >>>
The "and" and "or" operators in Python are actually not tru
>
> Currently I am working on just a prototype to show what is possible to
> be done to get me some fundings for my future work. after that I will
> get over to an SQL Alchemy. It's ORM will take over this business for
> me.
>
> A lot of people a not aware of SQL injection. My friend from college
>
>
> It seems as though Python is actually expanding range(2,n) into a list of
> numbers, even though this is incredibly wasteful of memory. There should be
> a looping mechanism that generates the index variable values incrementally
> as they are needed.
This has nothing to do with Python's for l
And .splitlines seems to be able to handle all "standard" end-of-line
> markers without any special direction (which, ironically, strikes
> me as a *little* Perlish, somehow):
>
> >>> "spam\015\012ham\015eggs\012".splitlines(True)
> ['spam\r\n', 'ham\r', 'eggs\n']
>
... actually "working correctly
On Fri, Aug 21, 2009 at 9:33 AM, Jamie wrote:
> My goal is to remotely remove the registry keys for McAfee. I don't
> know how winreg handles an exception if a key doesn't exist, but I
> setup my script to skip the exception. But it doesn't seem to work
> right.. I think the script should be self
>
>
> WTF??
> Why on IDLE it works, but when i run this script in cmd.exe, the
> os.getenv('HOME') goes NoneType?
> I'm to newbie yet to understand this :/
>
HOME is simply not a standard environment variable that Windows provides.
Any program can set/add environment variables as it deems fit; in
>
> The proper path is "C:\\Users\\Ryniek's
> WinSe7en\\MyNewGGBackup(2009-08-23 14:59:02).tar.bz2"
> and that string literal is "\U", without any pipes :)
>
> The truth is that script works on linux (ubuntu) but not on windows
> (neither Win7 nor WinXP).
> Maybe it's good idea to use raw string f
>
>I was wondering if some people in this ng use Python and some GUI
> toolkit (PyWin32, wxWidgets, QT, etc.) to build professional
> applications, and if yes, what it's like, the pros and cons, etc.
My company does. A few years ago we decided to re-write our entire aging
product line in
>
> > You should be setting the terminal encoding administratively, not
> > programmatically.
> >
>
> The terminal encoding has always been utf-8. It was not set
> programmatically.
>
> It seems to me that python 3.1's string handling is broken.
> Apparently, in python 3.1 I am unable to explicitl
>
>
> But http://docs.python.org/tutorial/classes.html says, in Section 9.3 "A
> First Look at Classes":
>
> When a class definition is entered, a new namespace is created,
> and used as the local scope — thus, all assignments to local variables
> go into this new namespace. In particular, function
>
> num1 = raw_input('Enter the first number: ')
> num2 = raw_input('Enter the second number: ')
> op = raw_input('Select one of the following [+-*/]: ')
> print 'The answer is: ', int(num1), eval(op), int(num2)
>
>
> How do I convert the contents of "op"
>
> > I would use the following approach:
>
> Abviously the OP is a python baby noob and casting your irrational
> fear (and many others irrational fears) of eval at him is akin to
> tales of Chupacabras running a muck in the jungle sucking the blood
> from live goats in the twilight hours. I use e
>
> Unicode (*puke*) seems nothing more than a brain fart of morons. And
> sadly it was created by CS majors who i assumed used logic and
> deductive reasoning but i must be wrong. Why should the larger world
> keep supporting such antiquated languages and character sets through
> Unicode? What pur
>
> So why the heck are we supporting such capitalistic implementations as
> Unicode. Sure we must support a winders installer but Unicode, dump
> it! We don't support a Python group in Chinese or French, so why this?
> Makes no sense to me really. Let M$ deal with it.
>
Who, exactly, do you think
On Sun, Aug 30, 2009 at 9:56 AM, Vitaly Babiy wrote:
> Hey,
> Any one know of a good thread pool library. I have tried a few but they
> don't seem to clean up after them selfs well.
>
> Thanks,
> Vitaly Babiy
>
>
As obscene as it seems, I actually use twisted's :)
I mean, it's obscene not becaus
On Sun, Aug 30, 2009 at 1:06 PM, John Haggerty wrote:
> twisted? I don't get it
>
Twisted. Big library / framework for network'd applications. Specifically,
asynchronous network'd applications, really.
--S
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 1, 2009 at 8:22 AM, Philipp Hagemeister wrote:
> class X(object):
>def __int__(self): return 42
>def __hex__(self): return '2b' #sic
>
> hex(X())
>
>
> What would you expect? Python2 returns '2b', but python 3(74624) throws
> TypeError: 'X' object cannot be interpreted as an in
> >> An implication of all this is that if now I wanted to create a new
> >> module x.y.z.w, this means that the previously "leaf"-module x.y.z
> >> would become "non-leaf". In other words, I'd have to:
> >>
> >> 1. create the new directory x/y/z
> >> 2. *rename* the file x/y/z.py to x/y/z/__init_
>
> The amazing thing is when file_str = 'C:\Qt\SimLCM\Default
> \Data_Input_Material.txt',
> the first if statement if fulfilled, that seemingly says that in this
> file_str, python actually finds the word 'Geometry'.
> I know this, because the line: 'I found geometry' is printed. However,
> if i
On Wed, Sep 2, 2009 at 10:33 PM, Helvin Lui wrote:
> Thanks! I just realised that too, but I used the condition:.find() >
> 0 But I think your's is better.
> Simple programming knowledge... > <
>
Ah, but != 0 vs > 0 isn't a question of better, but correctness: because if
.find() returns 0,
On Sat, Sep 5, 2009 at 6:51 PM, kj wrote:
> In <02b2e6ca$0$17565$c3e8...@news.astraweb.com> Steven D'Aprano <
> st...@remove-this-cybersource.com.au> writes:
>
> >(3) For quick and dirty scripts, or programs that only use one or two
> >files, relying on the VM to close the file is sufficient (alt
>
> It's just too bad that 'with' doesn't support multiple separate "x as y"
>> clauses.
>>
>
> The developers already agreed with you ;-).
>
> "With more than one item, the context managers are processed as if multiple
> with statements were nested:
>
> with A() as a, B() as b:
>suite
> is equ
On Sun, Sep 6, 2009 at 4:31 PM, r wrote:
> On Sep 6, 1:14 pm, "Jan Kaliszewski" wrote:
> > 05-09-2009 r wrote:
> > > i find the with statement (while quite useful in general
> > > practice) is not a "cure all" for situations that need and exception
> > > caught.
> >
> > In what sense?
>
> *ahem
>
> As per the standard posted by the UNICODE for the Devnagari script
> used for Hindi and some other languages of India, we have a standard
> set, like from the range of 0900-097F.
> Where, we have numbers for each character:
> like 0904 for Devnagari letter short a, etc.
> Now, if write a progra
On Fri, Sep 18, 2009 at 10:00 AM, Jamie Riotto wrote:
> I have an app that uses Python scripting. When a user creates a new object:
>
> objName = newObject()
>
> I'd like the newObject be able to use objName as its internal name.
>
Almost this exact same question came up not so long ago, which is
t somewhere). The latter is -- a class? A function? No idea, as
you haven't shown us. Nor shown any errors or any tracebacks or
*anything* to indicate what is possibly going on, let alone what is
going wrong when you, I presume, attempt to "call .. something .. from
the calling script". (?
701 - 739 of 739 matches
Mail list logo