Re: editor recommendations?

2021-03-02 Thread Russell
Ethan Furman wrote: > I'm currently using vim, and the primary reason I've stuck with it for so > long is because I can get truly black screens with it. By which I mean that > I have a colorful window title bar, a light-grey menu bar, and then a > light-grey frame around the text-editing windo

Re: editor recommendations?

2021-03-07 Thread Russell
Dan Stromberg wrote: > On Tue, Mar 2, 2021 at 8:11 PM Dan Stromberg wrote: > >> >> On Tue, Mar 2, 2021 at 8:00 PM Russell wrote: >> >>> Ethan Furman wrote: >>> > I'm currently using vim, and the primary reason I've stuck with it for >&

Re: editor recommendations?

2021-03-08 Thread Russell
Cameron Simpson wrote: >>-- Emacs outshines all other editing software in approximately the same >>way that the noonday sun does the stars. It is not just bigger and >>brighter; it simply makes everything else vanish. ??? Neal Stephenson Neal Stephenson's book Cryptonomicon was the reason I be

Re: for installation of pygames.

2021-05-07 Thread Russell
mishrasamir2...@gmail.com wrote: >Sir/madam, > >I'm a user of python , so I'm requesting you to give me permission to run >pygames . > >Thankyou > >Samir Mishra > > > > > >Sent from [1]Mail for Windows > > References > >Visible links >1. https://go.microso

ctypes.cdll.LoadLibrary() freezes when loading a .so that contains dlopen()

2015-02-13 Thread Russell
I have a shared library, libfoo.so, that references another .so which isn't linked but instead loaded at runtime with myso=dlopen("/usr/local/lib/libbar.so", RTLD_NOW); when I try to load it with ctypes, the call hangs and I have to ctl-c. (build)[dev]$ export LD_LIBRARY_PATH=/usr/local/bin (bu

Re: ctypes.cdll.LoadLibrary() freezes when loading a .so that contains dlopen()

2015-02-13 Thread Russell
On Friday, February 13, 2015 at 7:27:54 PM UTC-6, Ian wrote: > On Fri, Feb 13, 2015 at 8:39 AM, Russell wrote: > > I have a shared library, libfoo.so, that references another .so which isn't > > linked but instead loaded at runtime with > > myso=dlopen("/usr

How do I dynamically create functions without lambda?

2006-01-27 Thread Russell
I want my code to be Python 3000 compliant, and hear that lambda is being eliminated. The problem is that I want to partially bind an existing function with a value "foo" that isn't known until run-time: someobject.newfunc = lambda x: f(foo, x) The reason a nested function doesn't work for thi

Question from a python newbie

2007-12-13 Thread Russell
I've been learning Python slowly for a few months, coming from a C/C+ +, C#, Java, PHP background. I ran across a code fragment I'm having trouble wrapping my brain around. I've searched the Language Reference and was not able to find any info regarding the structure of this code fragment: int(t

Re: Question from a python newbie

2007-12-13 Thread Russell
I suspected it was a ternary type of operator, but was unable to confirm it. And I didn't realize it was new to 2.5. Perfectly clear now. :) Thanks! -- http://mail.python.org/mailman/listinfo/python-list

How does a generator object refer to itself?

2006-05-22 Thread Russell
This is more a Python 2.5 question, since it is the send() method that makes this so useful. The issue is how to write a generator that refers to its own generator object. This would be useful when passing control to some other function or generator that is expected to return control via a send():

Re: How does a generator object refer to itself?

2006-05-26 Thread Russell
Michael wrote: > You don't need python 2.5 at all to do this. You do need to > have a token mutable first argument though, as you can see. Thank you. That's a pattern similar to one we're using, where a new object refers to the generator. The problem we're seeing is that it seems to fool the garba

Re: How does a generator object refer to itself?

2006-05-26 Thread Russell
> Why don't you use a class ? Because we use this pattern for thousands of functions, and don't want thousands of new classes. Right now we use a single class that creates an instance for each such generator. I was hoping to find a way to get even more lightweight than that. :-) -- http://mail.p

Beautiful Soup Table Parsing

2012-08-08 Thread Tom Russell
I am parsing out a web page at http://online.wsj.com/mdc/public/page/2_3021-tradingdiary2.html?mod=mdc_pastcalendar using BeautifulSoup. My problem is that I can parse into the table where the data I want resides but I cannot seem to figure out how to go about grabbing the contents of the cell nex

Re: Generator problem: parent class not seen

2012-02-01 Thread Russell Owen
On Feb 1, 2012, at 2:34 PM, Chris Rebert wrote: > On Wed, Feb 1, 2012 at 1:00 PM, Russell E. Owen wrote: >> I have an odd and very intermittent problem in Python script. >> Occasionally it fails with this error: >> >> Traceback (most recent call last): >> Fi

Re: Generator problem: parent class not seen

2012-02-01 Thread Russell Owen
On Feb 1, 2012, at 3:35 PM, Arnaud Delobelle wrote: > On Feb 1, 2012 9:01 PM, "Russell E. Owen" wrote: > > > > I have an odd and very intermittent problem in Python script. > > Occasionally it fails with this error: > > > > Traceback (most recent c

Re: What's the best way to minimize the need of run time checks?

2016-08-11 Thread Russell Owen
ally. This will not catch everything that a compiler would catch in a compiled language, but it will catch many common errors. -- Russell -- https://mail.python.org/mailman/listinfo/python-list

Re: Anaconda with Python 3.7

2018-09-28 Thread Russell Owen
and are also dealing with issues with dependency management. In any case miniconda is available for 3.7 so it is worth checking to see if it has the packages that you need. (And if it’s just missing a few you can see if pip will install those). -- Russell -- https://mail.python.org/mailman/lis

asyncio await different coroutines on the same socket?

2018-10-03 Thread Russell Owen
with is ugly, using multiple layers of "async def”, keeping a record of Tasks that are waiting and calling "set_result" on those Tasks when finished. Also Task isn’t even documented to have the set_result method (though "future" is) Is there a simple, idiomatic way to do

How to await multiple replies in arbitrary order (one coroutine per reply)?

2018-10-05 Thread Russell Owen
I can end when *I* say it's time to end, and if I'm not quick enough then it will time out gracefully. But maybe there's a simpler way to do this. It doesn't seem like it should be difficult, but I'm stumped. Any advice would be appreciated. -- Russell -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio await different coroutines on the same socket?

2018-10-05 Thread Russell Owen
On Oct 3, 2018, Ian Kelly wrote (in article): > On Wed, Oct 3, 2018 at 7:47 AM Russell Owen wrote: > > Using asyncio I am looking for a simple way to await multiple events where > > notification comes over the same socket (or other serial stream) in > > arbitrary > >

Is it possible to connect an awaitable to a Future, basically turning it into a Task?

2018-10-27 Thread Russell Owen
(especially if I have to cancel the wait, as I have to keep the extra task around so I can cancel it). So...just wondering if I missed something. Regards, Russell -- https://mail.python.org/mailman/listinfo/python-list

Rollover/wraparound time of time.clock() under win32?

2005-09-28 Thread Russell Warren
Does anyone know how long it takes for time.clock() to roll over under win32? I'm aware that it uses QueryPerformanceCounter under win32... when I've used this in the past (other languages) it is a great high-res 64-bit performance counter that doesn't roll-over for many (many) years, but I'm worr

Re: Rollover/wraparound time of time.clock() under win32?

2005-09-28 Thread Russell Warren
Thanks! That gets me exactly what I wanted. I don't think I would have been able to locate that code myself. Based on this code and some quick math it confirms that not only will the rollover be a looong way out, but that there will not be any loss in precision until ~ 30 years down the road. C

scope of socket.setdefaulttimeout?

2005-09-29 Thread Russell Warren
Does anyone know the scope of the socket.setdefaulttimeout call? Is it a cross-process/system setting or does it stay local in the application in which it is called? I've been testing this and it seems to stay in the application scope, but the paranoid side of me thinks I may be missing something

Threads and socket.setdefaulttimeout

2005-10-12 Thread Russell Warren
It appears that the timeout setting is contained within a process (thanks for the confirmation), but I've realized that the function doesn't play friendly with threads. If I have multiple threads using sockets and one (or more) is using timeouts, one thread affects the other and you get unpredicta

Re: Threads and socket.setdefaulttimeout

2005-10-19 Thread Russell Warren
Thanks for the detailed repsone... sorry for the lag in responding to it. After reading and further thought, the only reason I was using setdefaulttimeout in the first place (rather then using a direct settimeout on the socket) was because it seemed like the only way (and easy) of getting access t

Re: Accessing Postgress from Windows

2005-01-28 Thread Robby Russell
les/python/mxODBC.html Cheers, Robby -- /******* * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting & Development * --- Now hosting PostgreSQL 8.0! --- *

Re: pythonic equivalent of Mathematica's FixedPoint function

2005-02-01 Thread Russell Blau
"jelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > doh... > > https://sourceforge.net/projects/fixedpoint > > pardon me > I don't think that Tim's FixedPoint class is doing the same thing as Mathematica's FixedPoint function (or even anything remotely similar). Well, except for

Re: Generating images with text in them

2005-07-21 Thread Daren Russell
phil hunt wrote: > I am trying to generate some images (gifs or pngs) with text in > them. I can use the Python Imaging Library, but it only has access > to the default, rather crappy, font. > > Ideally I'd like to use one of the nicer fonts that come with my X > Windows installation. Using Tk

Re: Pickle, __init__, and classes

2005-08-02 Thread Russell Blau
"Yin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've created a class that reads in and processes a file in the > initializer __init__. The processing is fairly substantial, and thus, > instead of processing the file every time the object is created, I > pickle the object to a f

Re: Tar module issue

2005-02-07 Thread Russell Bungay
Hello, I'm using tarfile module to create an archive. For my example I'm using Amsn file and directory tree. My variables are like these ones: path = /home/chaica/downloads/amsn-0_94/skins/Tux/smileys/shades.gif fileName = amsn-0_94/skins/Tux/smileys/shades.gif tar.add( path, fileName ) and while

Re: Questions about mathematical signs...

2005-02-07 Thread Russell Blau
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jeff Epler wrote: > > On Sun, Feb 06, 2005 at 12:26:30PM -0800, administrata wrote: > > > Hi! I'm programming maths programs. > > > And I got some questions about mathematical signs. > ... > > > 2. Inputing fractions like (a

Re: How would you program this?

2005-03-02 Thread Russell Blau
"engsol" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There is a number puzzle which appears in the daily paper. > Because I'm between Python projects, I thought it might be > fun to write a program to solve it20 minute job, max. > > On closer inspection, it became apparent tha

Re: using Tkinter from IDLE

2005-03-03 Thread Russell Blau
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How do I use Tkinter from IDLE? Tkinter can be used from IDLE attached > to python 2.2, IDLE 0.8. But I couldn't use from IDLE attached to > python 2.3, IDLE 1.0.3. When I execute the code below: > from Tkinter import * > root = Tk()

Re: rearrange text

2005-03-03 Thread Russell Blau
"Daniel Skinner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I have the following text > > var = '1,2,3,4' > > and I want to use the comma as a field delimeter and rearrange the > fields to read > > '1,3,2,4' > > How would I accomplish this in python? Well, it kind of depends

Re: How would you program this?

2005-03-03 Thread Russell Blau
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Wed, 2 Mar 2005 13:44:07 -0500, "Russell Blau" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > What you have is a set of 10

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Russell Blau
"It's me" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > In REXX, for instance, one can do a: > > interpret y' = 4' > > Since y contains a, then the above statement amongs to: > > a = 4 > > There are many situations where this is useful. For instance, you might be > getti

Re: More baby squeaking - iterators in a class

2004-12-30 Thread Russell Blau
"Bulba!" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello Mr Everyone, > > From: > http://docs.python.org/tut/node11.html#SECTION001190 > > "Define a __iter__() method which returns an object with a next() > method. If the class defines next(), then __iter__() can

Best IDE

2005-03-22 Thread tom . russell
If money is not an issue, what are the best options for a "Professional" IDE for Python that includes all the normal stuff PLUS a GUI Builder?? Its an open ended question but I need some opinions from those that have actually used some stuff. This is for a business producing in house programs fo

Python IDE

2005-03-24 Thread tom . russell
Has anyone used BlackAdder IDE for any project small or big? Whats your opinion? Thanks, Tom :. CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and may be privileged. If  you are not a named recipient, please notify the sender immediately and do not disclo

Re: How to install PIL or PILLOW on OS X Yosemite?

2015-02-19 Thread Russell Owen
aries and tools. If you want to stick with python.org python then a binary PIL installer is available here: <http://www.astro.washington.edu/users/rowen/python/> (I am not aware of any Pillow binaries). -- Russell -- https://mail.python.org/mailman/listinfo/python-list

Re: Picking apart a text line

2015-03-02 Thread Russell Owen
ng up requires some overhead. Simpler alternatives include using SQLite, a simple file-based database system, or numpy structured arrays (arrays with named fields). Python includes a standard library module for sqlite and numpy is easy to install. -- Russell -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to calculate fraction part of x?

2015-03-26 Thread Russell Owen
On 3/24/15 6:39 PM, Jason Swails wrote: On Mon, Mar 23, 2015 at 8:38 PM, Emile van Sebille mailto:em...@fenx.com>> wrote: On 3/23/2015 5:52 AM, Steven D'Aprano wrote: Are there any other, possibly better, ways to calculate the fractional part of a number? flo

Re: Quick question, if you please

2015-03-31 Thread Russell Owen
version each time? Thanks for your kind attention, John Kelly I would need more information to help. What operating system are you on? How and where are you installing Python (and what do you mean by "received Python with another install"?). -- Russell -- https://mail.python.o

Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Russell Brennan
I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() Or is it proper form to use a short-circuiting boolean: def doThis(arg1

Re: tkinter resize question

2015-07-17 Thread Russell Owen
ght of the child widgets, frames, etc. Or am I incorrect with this? I'm not seeing it. If I try the following script I see that resizing the widget does update frame.winfo_width() and winfo_height. (I also see that the requested width and height are ignored; you can omit those). -- Russe

IMAP4_SSL error

2006-01-04 Thread Russell Stewart
.py", line 1114, in open self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile) AttributeError: 'module' object has no attribute 'ssl' Any ideas? I'm running Active State Python 2.4 in WinXP SP2. -- Russell Stewart | E-Mail: [EMAIL PROTECTED] UNM CS Departme

email modules and attachments that aren't there

2006-01-09 Thread Russell Bungay
and one or two random searches but can't see what is happening. Any advice or suggestions would be welcome. Thank you for your help, Russell Bungay -- The Duck Quacks: http://www-users.york.ac.uk/~rb502/ - Homepage http://www-users.york.ac.uk/~rb502/blog/quack.shtml - Blog http://www.flick

Re: email modules and attachments that aren't there

2006-01-10 Thread Russell Bungay
the number of attachments and changing the header suitably does the job. Thank you for your help, Russell -- The Duck Quacks: http://www-users.york.ac.uk/~rb502/ - Homepage http://www-users.york.ac.uk/~rb502/blog/quack.shtml - Blog http://www.flickr.com/photos/lsnduck/ - Photos -- http://mail.python.org/mailman/listinfo/python-list

Re: email modules and attachments that aren't there

2006-01-10 Thread Russell Bungay
t test on the number of attachments and > changing the header suitably does the job. That isn't quite all there is to it, the e-mail construction needs a slight change as well. Roughly working code below. Ta, Russell Code: def sendEmail(msg_to, msg_from, msg_subject, message, atta

Re: email modules and attachments that aren't there

2006-01-10 Thread Russell Bungay
Russell Bungay wrote: > for attachment in attachments: > > sub_msg = email.Message.Message() > sub_msg.add_header('Content-type', content_type, name=attachment) > sub_msg.add_header('Content-transfer-encoding'

Implied instance attribute creation when referencing a class attribute

2006-01-16 Thread Russell Warren
I just ran across a case which seems like an odd exception to either what I understand as the "normal" variable lookup scheme in an instance/object heirarchy, or to the rules regarding variable usage before creation. Check this out: >>> class foo(object): ... I = 1 ... def __init__(self): ...

Re: Implied instance attribute creation when referencing a class attribute

2006-01-16 Thread Russell Warren
> I can see how this can be confusing, but I think the confusion here is > yours, not Pythons ;) This is very possible, but I don't think in the way you describe! > self.I += 10 is an *assignment*. Like any assignment, it causes the > attribute in question to be created ... no it isn't. The +=

Re: Implied instance attribute creation when referencing a class attribute

2006-01-16 Thread Russell Warren
D'oh... I just realized why this is happening. It is clear in the longhand as you say, but I don't think in the way you descibed it (or I'm so far gone right now I have lost it). self.I += 1 is the same as self.I = self.I + 1 and when python tries figures out what the 'self.I' is on the ri

Re: Implied instance attribute creation when referencing a class attribute

2006-01-16 Thread Russell Warren
Thanks for the additional examples, David (didn't see this before my last post). All of it makes sense now, including those examples. Russ -- http://mail.python.org/mailman/listinfo/python-list

How to convert arbitrary objects directly to base64 without initial string conversion?

2006-07-13 Thread Russell Warren
I've got a case where I want to convert binary blocks of data (various ctypes objects) to base64 strings. The conversion calls in the base64 module expect strings as input, so right now I'm converting the binary blocks to strings first, then converting the resulting string to base64. This seems h

Re: How to convert arbitrary objects directly to base64 without initial string conversion?

2006-07-13 Thread Russell Warren
> Many functions that operate on strings also accept buffer objects as > parameters, > this seems also be the case for the base64.encodestring function. ctypes > objects > support the buffer interface. > > So, base64.b64encode(buffer(ctypes_instance)) should work efficiently. Thanks! I have ne

Re: How to convert arbitrary objects directly to base64 without initial string conversion?

2006-07-13 Thread Russell Warren
After some digging around it appears there is not a tonne of documentation on buffer objects, although they are clearly core and ancient... been sifting through some hits circa 1999, long before my python introduction. What I can find says that buffer is deprecated (Python in a Nutshell), or non-e

Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-26 Thread Russell Warren
I've been having a hard time tracking down a very intermittent problem where I get a "permission denied" error when trying to rename a file to something that has just been deleted (on win32). The code snippet that gets repeatedly called is here: ... if os.path.exists(oldPath): os.remove(o

Re: Threads vs Processes

2006-07-26 Thread Russell Warren
> Another issue is the libraries you use. A lot of them aren't > thread safe. So you need to watch out. This is something I have a streak of paranoia about (after discovering that the current xmlrpclib has some thread safety issues). Is there a list maintained anywhere of the modules that are are

Re: Threads vs Processes

2006-07-26 Thread Russell Warren
Oops - minor correction... xmlrpclib is fine (I think/hope). It is SimpleXMLRPCServer that currently has issues. It uses thread-unfriendly sys.exc_value and sys.exc_type... this is being corrected. -- http://mail.python.org/mailman/listinfo/python-list

Re: Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-26 Thread Russell Warren
> Are you running a background file accessing tool like Google Desktop > Search or an anti-virus application? If so, try turning them off as a test. I'm actually running both... but I would think that once os.remove returns that the file is actually gone from the hdd. Why would either applica

Re: Intermittent "permission denied" errors when using os.rename and a recently deleted path??

2006-07-27 Thread Russell Warren
> Does it actually tell you the target is the problem? I see an > "OSError: [Errno 17] File exists" for that case, not a permission error. > A permission error could occur, for example, if GDS has the source open > or locked when you call os.rename. No it doesn't tell me the target is the issu

TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Why does this work from the python prompt, but fail from a script? How does one make it work from a script? #! /usr/bin/python import glob # following line works from python prompt; why not in script? files=glob.glob('*.py') print files Traceback (most recent call last): File "./glob.py", line

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > > Don't call your file `glob.py` because then you import this module and not > the `glob` module from the standard library. > > Ciao, > Marc 'BlackJack' Rintsch Yes, thanks. Renaming to myglob.py solved the problem. But why does the conflict not occur w

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
John Machin wrote: > > Contemplate the following: > > C:\junk>type glob.py > if __name__ == "__main__": > print "*** Being run as a script ..." > import glob > print "glob was imported from", glob.__file__ > print "glob.glob is", type(glob.glob) > print "glob.glob was importe

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Charles Russell wrote: But why does the > conflict not occur when the code is run interactively from the python > prompt? Because, I now realize, I had not yet created glob.py when I tried that. -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'module' object is not callable (newby question)

2006-08-15 Thread Charles Russell
Charles Russell wrote: I haven't found the magic word to invoke a > .py script from the python prompt (like the command "source" in csh, > bash, tcl?) Seems to be execfile() -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'module' object is not callable (newby question)

2006-08-15 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > Here's the index of the reference manual: > > http://docs.python.org/ref/genindex.html > Thanks. When I go up a level from there, I find a pointer to the index right at the bottom of the table of contents, which I had overlooked. -- http://mail.python.org/m

Funky file contents when os.rename or os.remove are interrupted

2006-10-10 Thread Russell Warren
I've got a case where I'm seeing text files that are either all null characters, or are trailed with nulls due to interrupted file access resulting from an electrical power interruption on the WinXP pc. In tracking it down, it seems that what is being interrupted is either os.remove(), or os.renam

Re: Funky file contents when os.rename or os.remove are interrupted

2006-10-11 Thread Russell Warren
Thanks, guys... this has all been very useful information. The machine this is happening on is already running NTFS. The good news is that we just discovered/remembered that there is a write-caching option (in device manager -> HDD -> properties -> Policies tab) available in XP. The note right b

Recommended way to fix core python distribution issues in your own apps?

2006-06-19 Thread Russell Warren
I've got a case where I need to tweak the implementation of a default python library due to what I consider to be an issue in the library. What is the best way to do this and make an attempt to remain compatible with future releases? My specific problem is with the clock used in the threading.Eve

Is Queue.Queue.queue.clear() thread-safe?

2006-06-22 Thread Russell Warren
I'm guessing no, since it skips down through any Lock semantics, but I'm wondering what the best way to clear a Queue is then. Esentially I want to do a "get all" and ignore what pops out, but I don't want to loop through a .get until empty because that could potentially end up racing another thre

Re: better Python IDE? Mimics Maya's script editor?

2006-06-22 Thread Russell Warren
Check out the Wing IDE - www.wingware.com . As part of it's general greatness it has a "debug probe" which lets you execute code snippets on active data in mid-debug execution. It doesn't have precisely what you are after... you can't (yet) highlight code segments and say "run this, please", but

Re: Is Queue.Queue.queue.clear() thread-safe?

2006-06-27 Thread Russell Warren
Thanks guys. This has helped decipher a bit of the Queue mechanics for me. Regarding my initial clear method hopes... to be safe, I've re-organized some things to make this a little easier for me. I will still need to clear out junk from the Queue, but I've switched it so that least I can stop t

Re: static object

2007-01-03 Thread Russell Owen
is simple and it works: _theSingleton = None def getSingleton(): global _theSingleton if not _theSingleton: _theSingleton = _Singleton() return _theSingleton class _Singleton: def __init__(self, ...): ... -- Russell -- http://mail.python.org/mailman/listinfo/python-list

wxPython Conventions

2006-01-30 Thread Jared Russell
I've recently decided to try my hand at GUI programming with wxPython, and I've got a couple questions about the general conventions regarding it. To mess around with it, I decided to create a small app to check my Gmail. I want something that will just sit in my system tray checking for new emai

Re: wxPython Conventions

2006-02-05 Thread Jared Russell
Thanks for all the replies. I'm admittedly new to GUI programming, so I'm making sure to read up on the MVC pattern and related things like the observer pattern. I appreciate the help. Jared -- http://mail.python.org/mailman/listinfo/python-list

Finding the public callables of self

2006-02-09 Thread Russell Warren
Is there any better way to get a list of the public callables of self other than this? myCallables = [] classDir = dir(self) for s in classDir: attr = self.__getattribute__(s) if callable(attr) and (not s.startswith("_")): myCallables.append(s) #collect the names (n

Re: Finding the public callables of self

2006-02-09 Thread Russell Warren
> import inspect > myCallables = [name for name, value in inspect.getmembers(self) if not > name.startswith('_') and callable(value)] Thanks. I forgot about the inspect module. Interestingly, you've also answered my question more than I suspect you know! Check out the code for inspect.getmember

Re: absolute removal of '\n' and the like

2006-02-10 Thread Russell Blau
"S Borg" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I have a string, what is the strongest way to assure the > removal of any line break characters? > > Line break characters must always be the last character in a line, so > would > this:str = linestring[:-1] > > work?

Profiling/performance monitoring in win32

2006-02-17 Thread Russell Warren
The application we're working on at my company currently has about eleventy billion independent python applications/process running and talking to each other on a win32 platform. When problems crop up and we have to drill down to figure out who is to blame and how, we currently are using the (surp

Re: Lisp-like macros in Python?

2007-05-01 Thread Chris Russell
On May 1, 5:10 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > Hello > > The Lisp crowd always brags about their magical macros. I was > wondering if it is possible to emulate some of the functionality in > Python using a function decorator that evals Python code in the stack > frame of the caller. T

Re: The meaning of a = b in object oriented languages

2007-09-17 Thread Russell Wallace
Summercool wrote: > so most or all object oriented language do assignment by reference? > is there any object oriented language actually do assignment by > value? I kind of remember in C++, if you do > > Animal a, b; > > a = b will actually be assignment by value. > while in Java, Python, and Ru

logging module and trailing newlines

2007-10-02 Thread Russell Warren
I was just setting up some logging in a make script and decided to give the built-in logging module a go, but I just found out that the base StreamHandler always puts a newline at the end of each log. There is a comment in the code that says "The record is then written to the stream with a trailin

Re: logging module and trailing newlines

2007-10-03 Thread Russell Warren
Both are very good responses... thanks! I had forgotten the ease of "monkey-patching" in python and the Stream class is certainly cleaner than the way I had been doing it. On Oct 3, 3:15 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Russell Warren wrote: > > All I'

Re: Looking for a good Python environment

2007-11-11 Thread Russell Warren
> While we're at it, do any of these debuggers implement a good way to > debug multi-threaded Python programs? Wing now has multi-threaded debugging. I'm a big Wing (pro) fan. To be fair, when I undertook my huge IDE evaluation undertaking it was approx 2 years ago... at the time as far as what

Tkinter weirdness on Windows

2007-12-15 Thread Russell Blau
I have some Tkinter programs that I run on two different machines. On Machine W, which runs Python 2.5.1 on Windows XP, these programs run just fine. On Machine H, which runs Python 2.5.1 on Windows XP, however, the same programs crash regularly. The crashes are not Python exceptions, but rat

Re: Python; jump to a concrete line

2007-12-20 Thread Russell Blau
"Horacius ReX" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, sorry but after looking for information, I still did not get how, > when reading a text file in python, can one jump to a concrete line > and then read the different data (separated by spaces). In each line > there is

Python/Tkinter DLL conflicts on Windows

2007-12-26 Thread Russell Blau
I have some Tkinter programs that I run on two different machines. On Machine W, which runs Python 2.5.1 on Windows XP, these programs run fine. On Machine H, which runs Python 2.5.1 on Windows XP, however, the same programs crash regularly. The crashes are not Python exceptions, but rather a

Speed of shutil.copy vs os.system("copy src dest") in win32

2006-04-26 Thread Russell Warren
I just did a comparison of the copying speed of shutil.copy against the speed of a direct windows copy using os.system. I copied a file that was 1083 KB. I'm very interested to see that the shutil.copy copyfileobj implementation of hacking through the file and writing a new one is significantly f

Re: win32com short path name on 2k

2006-04-26 Thread Russell Warren
I've been driven crazy by this type of thing in the past. In my case it was with the same application (not two like you), but on different machines, with all supposedly having the same OS load. In some cases I would get short path names and in others I would get long path names. I could never fig

Popping from the middle of a deque + deque rotation speed

2006-04-28 Thread Russell Warren
Does anyone have an easier/faster/better way of popping from the middle of a deque than this? class mydeque(deque): def popmiddle(self, pos): self.rotate(-pos) ret = self.popleft() self.rotate(pos) return ret I do recognize that this is not the intent of a deque, given the clear

Re: Popping from the middle of a deque + deque rotation speed

2006-05-01 Thread Russell Warren
Thanks for the responses. > It seems to work with my Python2.4 here. If you're > interested in efficiency, I'll leave their comparison as an > exercise to the reader... :) Ok, exercise complete! :) For the record, they are pretty much the same speed... >>> s = """ ... from collections import d

Re: Popping from the middle of a deque + deque rotation speed

2006-05-01 Thread Russell Warren
> So does the speed of the remaining 0.001 cases really matter? Note > that even just indexing into a deque takes O(index) time. It doesn't matter as much, of course, but I was looking to make every step as efficient as possible (while staying in python). As to indexing into a deque being O(inde

Is crawling the stack "bad"? Why?

2008-02-24 Thread Russell Warren
I've got a case where I would like to know exactly what IP address a client made an RPC request from. This info needs to be known inside the RPC function. I also want to make sure that the IP address obtained is definitely the correct one for the client being served by the immediate function call

Re: Is crawling the stack "bad"? Why?

2008-02-24 Thread Russell Warren
Argh... the code wrapped... I thought I made it narrow enough. Here is the same code (sorry), but now actually pasteable. --- import SimpleXMLRPCServer, xmlrpclib, threading, sys def GetCallerNameAndArgs(StackDepth = 1): """This function returns a tuple (a,b) where: a = The name of the ca

Re: Is crawling the stack "bad"? Why?

2008-02-24 Thread Russell Warren
> That is just madness. What specifically makes it madness? Is it because sys._frame is "for internal and specialized purposes only"? :) > The incoming ip address is available to the request handler, see the > SocketServer docs I know... that is exactly where I get the address, just in a mad wa

Re: Is crawling the stack "bad"? Why?

2008-02-25 Thread Russell Warren
> How about a dictionary indexed by by the thread name. Ok... a functional implementation doing precisely that is at the bottom of this (using thread.get_ident), but making it possible to hand around this info cleanly seems a bit convoluted. Have I made it more complicated than I need to? There

Re: Is crawling the stack "bad"? Why?

2008-02-25 Thread Russell Warren
convincing argument yet on why crawling the stack is considered bad? I kind of hoped to come out of this with a convincing argument that would stick with me... On Feb 25, 12:30 pm, Ian Clark <[EMAIL PROTECTED]> wrote: > On 2008-02-25, Russell Warren <[EMAIL PROTECTED]> wrote: > > &

  1   2   3   >