Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Rhodri James
. Do you mean that one of the imported modules wishes to use an instance created in the main script? If that's the case, you're going to have to pass the instance to the module somehow, since the module knows nothing of what if anything has imported it. -- Rhodri James *-* Wildebeest Her

Re: Is there any way to access attributes from an imported module?

2011-10-03 Thread Rhodri James
doesn't grievously abuse at least one of the terms you are using. Could you post some illustrative code snippets, please? -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Rhodri James
u want more than one statement executed per step was to wrap sequences of statements in a SEQ construct. You end up indenting a long way very fast if you aren't careful. I'm afraid much as I love PAR, Python's dynamicism makes it rather more 'exciting' than it was in occam.

Re: Problem using execvp

2011-10-27 Thread James Housden
; > I searched and found many solutions like : os.execvp("./Launch.py", > > ["./Launch.py","ProcessName"]), but nothing worked so far. > > This works for me: > >      os.execvp("./Launch.py", ["ProcessName"]]) > > -- HansM Hello, This worked for me: os.execvp("./Launch.py", ["python", "ProcessName"]) Best regards, James -- http://mail.python.org/mailman/listinfo/python-list

Re: JSONBOT 0.80.3 RELEASED

2011-11-21 Thread James Matthews
Looks good I am going to plug twisted into this. On Mon, Nov 21, 2011 at 9:49 PM, Bart Thate wrote: > Hello world !! I released JSONBOT 0.80.3 .. the first in the 0.80 series ;] > > about > ~ > > JSONBOT is a chatbot that can take commands and react to events on the > network it is connected

Re: Multiple Threads - I/O in Same File

2011-11-21 Thread James Matthews
You may have some issues with disk reading as the drive heads move in different ways On Mon, Nov 21, 2011 at 8:15 AM, wrote: > Hi All, > > ** ** > > Just a question in general. Is it possible that we have opened one file > in r+ mode ( file1.txt ). > > We have 2 threads, > > **·

Re: text to html

2011-12-14 Thread James Mills
t pointers Hey Pedro, You could also use pygments to nicely format the logfile perhaps even with Syntax Highlighting. https://bitbucket.org/freecodeteam/hpaste/src/749c36d184a6/hpaste.circuits/paste.py You could also provide an "Download" link that services the file up as Content

Re: Calendar module question

2013-02-17 Thread James Griffin
- Phil [2013-02-17 17:47:15 +1000] - : > Thank you for reading this. > > My adventures with Python have just begun and during the few weeks I > have tried many IDEs. The following piece of code fails under all > IDEs, and the interpreter, except under the Wing IDE. > > Why would this co

Re: Shebang line on Windows?

2013-02-22 Thread James Harris
of course, OK when run as python program.py but that removes some of the benefit of the shebang line. James -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] string.format() default variable assignment

2013-03-02 Thread James Griffin
[- Sat 2.Mar'13 at 17:54:57 +1100 Chris Angelico :-] > On Sat, Mar 2, 2013 at 5:09 PM, Devin Jeanpierre > wrote: > > On Fri, Mar 1, 2013 at 10:54 PM, Chris Angelico wrote: > >>> No offence Chris, but you're the only person I know who *regularly* > >>> replies to the wrong list

Re: [Python-ideas] string.format() default variable assignment

2013-03-05 Thread James Griffin
[- Tue 5.Mar'13 at 2:42:07 + Steven D'Aprano :-] > On Mon, 04 Mar 2013 11:09:10 -0500, David Robinow wrote: > > > But here's what I don't understand. Why does somebody who posts as > > much as Steven (and thanks for that. Getting cussed at occasionally is a > > cheap pric

RFD: comp.sys.raspberry-pi

2013-03-09 Thread James Harris
groups news.groups.proposals comp.lang.forth comp.lang.python comp.os.linux.misc PROPONENT: James Harris james.harris.1Agmail.com (replace A with @ - but please discuss the proposal on Usenet!) CHANGE HISTORY: 2013-03-09 Initial RFD -- http://mail.python.org/mailman/listinfo/python-list

Replace "dash" values in a field with new line- VB equivalent of Python

2013-03-19 Thread Cathy James
Dear All, I need some assistance with Python so that values in the "Name" field e.g. Murray - James - Leo can be labeled as: Murray James Leo with a new line replacing every dash. Basically I need the equivalent of this VB in Python: replace ( [Name] , "-", vbNewLine) I tr

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-16 Thread James Jong
balls for tck/tk, sqlite or dl on the Scientific Linux website, but maybe I am not looking in the right place. Do you know how I can find which tarballs I need? James On Tue, Apr 16, 2013 at 12:55 PM, Terry Jan Reedy wrote: > On 4/16/2013 10:30 AM, rosoloum wrote: > >> I

Re: Understanding Boolean Expressions

2013-04-16 Thread Rhodri James
nals back you go further through precedence chain: comparisons, then bitwise operators (*not* bitwise comparisons!), then shifts, then arithmetic operators, the unary operators, the power operator, and finally primaries. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-17 Thread James Jong
7;t know what else to try. Any thoughts? Thanks, James On Tue, Apr 16, 2013 at 1:28 PM, James Jong wrote: > Thank you Terry, I am working with: > > cat /proc/version > Linux version 2.6.18-274.el5xen (brewbuil...@norob.fnal.gov) (gcc version > 4.1.2 20080704 (Red Hat 4.1.2-50))

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread James Jong
I should watch for? James, On Wed, Apr 17, 2013 at 9:59 PM, Chris Angelico wrote: > On Thu, Apr 18, 2013 at 8:39 AM, James Jong > wrote: > > I managed to compile sqlite with: > > > > CPPFLAGS='-I/path_to_sqlite-3.7.16.2/include -I/path_to_tk8.6.0/include'

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread James Jong
tkstub8.6.a tkConfig.sh libtk8.6.so == The file libtk8.6.so has 1.5M and is definitely there. So why did that compilation fail? James On Thu, Apr 18, 2013 at 11:05 AM, Jason Swails wrote: > > > > On Thu, Apr 18, 2013 at

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread James Jong
rough `LDFLAGS` * /path_to/sqlite3/lib * /path_to/tcl/lib * /path_to/tk/lib and the following lib paths through `LD_LIBRARY_PATH`: * /path_to/sqlite/lib * /path_to/tcl/lib * /path_to/tk/lib Thanks, James On Thu, Apr 18, 2013 at 12:24 PM, James Jong wrote: > Thanks Jason. I have pinpoi

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread James Jong
a similar system and copy it to the supercomputer). But this thread shows that, at least, setup.py tries to load libtk.so (a dynamic shared library). Does Python then load dynamic libraries from sqlite, tcl, tk when using the respective modules? James On Thu, Apr 18, 2013 at 3:10 PM, Terry Jan Re

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-21 Thread James Jong
I see, just to be clear, do you mean that Python 2.7.4 (stable) is incompatible with Tk 8.6 (stable)? James On Fri, Apr 19, 2013 at 12:27 PM, Serhiy Storchaka wrote: > 18.04.13 19:24, James Jong написав(ла): > >> The file libtk8.6.so <http://libtk8.6.so> has 1.5M and is d

Re: Scan CSV file and saving it into an array

2013-04-24 Thread Rhodri James
this less tedious to write. Odd that this subject should have come up so many times in various guises in the last week or two. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question about python and Tkinter

2005-12-11 Thread James Stroud
probably your problem. Seems like you might have a bug. Is this cygwin? If not try it. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Another newbie question

2005-12-12 Thread james . moughan
worked on horrible code and beautiful code, and I know what a difference these things make. However, you also cannot program blindly by general rules. The toughest code I've ever had to modify would probably have passed quite a few OO-style guides; the author was really trying to adhere to

Re: Newbie: executing a system command from my Python app

2005-12-12 Thread James Stroud
module for recursive deletion. 3. Use os.path to construct paths. Try to avoid, for example, "c:\blah\blah" on dos, '/blah/blah' on unix, etc. 4. If you only have one argument, you don't need a tuple for string formatting. 5. "(dateYest)" is not a tuple anywa

Re: Executing a python script with arguments from a python script

2005-12-12 Thread James Stroud
livier. > Obligatory "ugh." Are you sure you want to do that? Just make the part you want to execute into a function and then import it as a module. You will thank me later. To reluctantly answer your question: see os.system. But don't see os.system. Use python like pyth

Re: Executing a python script with arguments from a python script

2005-12-12 Thread James Stroud
on, it is a "More powerful command line option parser". http://docs.python.org/lib/module-optparse.html James -- http://mail.python.org/mailman/listinfo/python-list

Re: simple TkInter question - labels

2005-12-13 Thread James Stroud
ecify a bitmap or textual value to display in the widget; the image option may be reset to an empty string to re-enable a bitmap or text display." So try setting to an empty string instead of None. For many Tkinter issues, you can try: <http://www.astro.princeton.edu/~rhl/Tcl-Tk_docs/tk8

Interprocess communication and memory mapping

2005-12-14 Thread James Aguilar
old all of the data in memory as well? * Are there any other shared memory models that would work for this task? OK, I think that is enough. I look forward eagerly to your replies! Yours, James Aguilar -- http://mail.python.org/mailman/listinfo/python-list

Test the system is despised.

2005-12-14 Thread James Stroud
ell, write back with your admonishments, they will be wasted keystrokes. Sorry, I just want to read this list. On the upside, I wouldn't be so vehement about any other list. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Test the system is despised.

2005-12-14 Thread James Stroud
James Stroud wrote: > I know this is despised, but I am actually testing this list with an > email. If you knew the circles I've been running around trying to get > UCLA to fix their news server for the c.l.python list, you would not > blame me. The hours I've wasted on t

Re: Test the system is despised.

2005-12-14 Thread James Stroud
Grant Edwards wrote: > On 2005-12-15, James Stroud <[EMAIL PROTECTED]> wrote: > > >>I know this is despised, but I am actually testing this list with an >>email. If you knew the circles I've been running around trying to get >>UCLA to fix their news ser

Re: How do I bind to scrollbar?

2005-12-14 Thread James Stroud
ws if you are lucky. You will need to bind the scrollbar separately if you want it to respond to the mousewheel. See also: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266 (and the discussion that follows). James -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter: drop-down widget

2005-12-15 Thread James Stroud
Alex Hunsley wrote: > Can anyone recommend some code for creating drop-down menus in tkinter? > To be absolutely clear, here's an example of a drop-down: > > http://www.google.co.uk/preferences?hl=en > (see the language selection widget) > > I've found the odd bit of code here and there, such as:

Re: Clearing the Tkinter Window

2005-12-15 Thread James Stroud
t be garbage collected, even though they are destroyed when the frame is destroyed. James -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter canvas tag stuff

2005-12-16 Thread James Stroud
or message you are getting is an artefact of Tk. I have yet to find any Tkinter-specific documentation on the Canvas.addtag method, but the Tk documentation suggests the following is equivalent to the above: canvas.addtag("some_tag", "withtag", pic) James -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter canvas tag stuff

2005-12-16 Thread James Stroud
on on the Canvas.addtag method, but the Tk documentation suggests this has the same affect as above: canvas.addtag("some_tag", "withtag", pic ) James -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter interactive

2005-12-17 Thread James Stroud
from the hello world program of a new language to an interactive gui interface. I think you can save yourself a lot of frustration and confusion by first working throught the python tutorial: http://docs.python.org/tut/tut.html Then working throught the "Tkinter tutorial": http://w

Re: Interprocess communication and memory mapping

2005-12-20 Thread Aguilar, James
computing is in my future, one way or another, so I want to make sure it's possible to use python to do that well and efficiently. - James Aguilar -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation/whitespace

2005-12-23 Thread James Tanis
more Perl-like syntax. It doesn't quite have as much of a diverse module selection as Python and Perl but that will change with time. Open source gives us an unprecendented amount of choices, try them all out.. I have, and I came up with Python because for me it is the "best fit." That

Re: Indentation/whitespace

2005-12-23 Thread James Tanis
I wonder how so many coders actually came to be interested in the field -- one that pretty much thrives in part on its neverending ability to vary, grow, and change -- if something so small can warrant so much attention. -- James Tanis [EMAIL PROTECTED] http://pycoder.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation/whitespace

2005-12-24 Thread James Tanis
f usr.password == password or something less elaborate :P. > -- > http://mail.python.org/mailman/listinfo/python-list > -- James Tanis [EMAIL PROTECTED] http://pycoder.org -- http://mail.python.org/mailman/listinfo/python-list

Re: deal or no deal

2005-12-26 Thread james . moughan
, I've seen them offer more than the average on the UK version, which puzzled me quite a lot. James M -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation/whitespace

2005-12-26 Thread James Tanis
character. If I'm getting those mixed up, switch 'em around or whatever. I find true tabs to be very annoying since different editors/programs seem to translate them differently, just give me spaces :P. Their are plenty of freeware and proprietary programs that do both and everything in between

Re: python coding contest

2005-12-27 Thread James Tanis
mplementations with absolutely no documentation and plenty of one letter variable names. I haven't checked the web site either, are you allowing third party modules to be used? If so, that causes even more problems in the comparison. How are you going to compare those who use a module vs implement it themselves in pure python? -- James Tanis [EMAIL PROTECTED] http://pycoder.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a refrence issue?

2005-12-28 Thread James Tanis
o this. > Such as from the python docs.. import copy x = copy.copy(y)# make a shallow copy of y x = copy.deepcopy(y)# make a deep copy of y > -carl > > -- > > Carl J. Van Arsdall > [EMAIL PROTECTED] > Build and Release > MontaVista Software > > -- > http://mail.python.org/mailman/listinfo/python-list > -- James Tanis [EMAIL PROTECTED] http://pycoder.org -- http://mail.python.org/mailman/listinfo/python-list

Detecting problems in a forked process

2005-12-29 Thread James Colannino
ut then I realized that this wouldn't work due to the fact that I will have multiple forks doing the same thing at the same time. Thanks in advance :) James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "If Carpenters made houses the way programmers

Re: python speed

2006-01-06 Thread James Tanis
t;[EMAIL PROTECTED]> wrote: > Hi > are there any future perspectives for Python to be as fast as java? i > would like to use Python as a language for writing games. > > best regards > krystian > -- > http://mail.python.org/mailman/listinfo/python-list > -- James Tan

Re: Freezing

2006-01-13 Thread James Stroud
[EMAIL PROTECTED] wrote: > Dicts and sets require immutable keys, like tuples or frozensets Not really... def freeze(anobj): """returns a new hashable object""" import copy try: hash(anobj) except: pass else: return copy.deepcopy(anobj) class FrozenType(type): def __new__(c

Re: Limitting the Contents of an Entry Widget in Tkinter

2006-01-14 Thread James Stroud
independent and seem to correspond to events pretty well. For pasting, you will want to access the pasteboard(s) via Event.widget.selection_get(selection='PRIMARY') Event.widget.selection_get(selection='CLIPBOARD') in that order, using try/except. James -- http://mail.python.org/mailman/listinfo/python-list

Running DOS App on win32 via python over ssh

2006-01-16 Thread James Stroud
arted by cygwin & look to the main cygwin window for output (what is special about this window?). Then try sshing to your cygwin box and running. It locks up. Thanks in advance, James -- http://mail.python.org/mailman/listinfo/python-list

Re: magical expanding hash

2006-01-16 Thread James Stroud
braver wrote: > I need a magical expanding hash with the following properties: > > * it creates all intermediate keys > > meh['foo']['bar] = 1 > > -- works even if meh['foo'] didn't exist before > > * allows pushing new elements to leaves which are arrays > > meh['foo']['list] << elem1 > meh['

Re: Running DOS App on win32 via python over ssh

2006-01-17 Thread James Stroud
Peter Hansen wrote: > James Stroud wrote: > >> I am helping someone write a python script to run their DOS >> application through an SSH terminal. It seems that this program wants >> to access a DOS shell and send output there. If running remotely, this >> causes

Re: magical expanding hash

2006-01-17 Thread James Stroud
on't try this on a populated meh! return other m = meh() # mindreading way m['carol'] += 4 m['carol'] += 5 m['bob'] << 44 # "You are thinking of '44'." # better, not mindreading way m['alice'] = [10] m['a

Re: magical expanding hash

2006-01-17 Thread James Stroud
braver wrote: > Thanks, James! This is really helpful. > > : It would take a lot of coding to make that << work right. Better is > the pythonic > : > : m[key] = [value] > : > : Its really only one more keystroke than > : > : m[key] << value > >

Re: Returning a tuple-struct

2006-01-18 Thread James Stroud
[EMAIL PROTECTED] wrote: > I've noticed that there's a few functions that return what appears to > be a tuple, but that also has attributes for each item in the tuple. > For example, time.localtime() returns a time.time_struct, which looks > like a tuple but also like a struct. That is, I can do:

Extended List Comprehension

2006-01-20 Thread James Stroud
Would anyone else find this syntax useful for generator expressions? py> [x for x in '1234' if x%2 else 'even'] [1, 'even', 3, 'even'] I'm guessing this has been suggested before? James -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended List Comprehension

2006-01-20 Thread James Stroud
James Stroud wrote: > Would anyone else find this syntax useful for generator expressions? > > py> [x for x in '1234' if x%2 else 'even'] > [1, 'even', 3, 'even'] > > I'm guessing this has been suggested before? > > James

Re: The "real" name

2006-01-21 Thread James Stroud
[EMAIL PROTECTED] wrote: > I'm playing with a sudoku GUI...just to learn more about python. > > I've made 81 'cells'...actually small canvases > > Part of my scheme to write the cells (all 81 of them in the gui) to a file > (using the the SAVE callback/button), then > restore the gui cells from

Re: The "real" name

2006-01-21 Thread James Stroud
[EMAIL PROTECTED] wrote: > On Sat, 21 Jan 2006 14:23:49 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > > >>[EMAIL PROTECTED] wrote: >> >>>I'm playing with a sudoku GUI...just to learn more about python. >>> >>>I've made 81 'c

Re: how to run python scripts on a website

2006-01-21 Thread James Stroud
...how can i run > that? > > > thanks! > Here is a start. Put the following in your cgi-bin folder or equivalent. Name it test.cgi #!/usr/bin/python print "Content-Type: text/plain\n\n" print "Hello, World!\n" Now just browse it. E.g.: http://www.

Re: Python for Embedded Systems?

2006-07-14 Thread James Thiele
Jack wrote: > ...snip... > If Python is not the best candidate for embedded systems because > of the size, what (scripting) language would you recommend? > TCL is fairly popular in the embedded space. Fairly small footprint. The syntax is not to everyone's taste. -- http://mail.python.org/mailma

Re: regular expression - matches

2006-07-21 Thread James Oakley
ch easier. -- James Oakley [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: easy questions from python newbie

2006-07-23 Thread James Stroud
would it be best > for me to do this with a > multi-diminsional array? For example: sort the file, read a rec into > the array, if the next rec is the same then incr the count, otherwise > add a new rec with a count of 1. Then write the array to a file? > Ah, a real question. Use a

Re: easy questions from python newbie

2006-07-23 Thread James Stroud
John Machin wrote: > James Stroud wrote: > >>walterbyrd wrote: >> >>>This is the first real python program I have ever worked on. What I >>>want to do is: >>>1) count identical records in a cvs file >>>2) create a new file with quantities i

builtin function compile exceptions thrown?

2006-07-26 Thread James Thiele
What exceptions (if any) can the python builtin compile() function throw besides SyntaxError? -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin function compile exceptions thrown?

2006-07-27 Thread James Thiele
Thank you, James Martin v. Löwis wrote: > James Thiele wrote: > > What exceptions (if any) can the python builtin compile() function > > throw besides SyntaxError? > > - TypeError, if the parameters are wrong/too many/too few > - Any errors that a codec may raise,

Proposal for new option -U extending -u

2006-07-29 Thread James Thiele
Currently -u specifies that stdin, stdout and stderr are all unbuffered. I propose a that -U make all files unbuffered. It could be useful for programs that log to files. Comments solicited. -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. Linux

2006-07-30 Thread James Stroud
-boot of Linux or maybe a VMWare install to > program under Python? > I recommend a triple boot mac. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows vs. Linux

2006-07-31 Thread James Stroud
r') than "\\".join(['my', 'favorite', 'dir']) because the latter will bonk on linux. The former is platform independent. This hits at the same issue as using os.sep: os.sep.join(['my', 'favorite', 'dir']) But os.pat

Re: py2app semi-standalone semi-works

2006-10-04 Thread James Stroud
Dave Opstad wrote: > In article <[EMAIL PROTECTED]>, > James Stroud <[EMAIL PROTECTED]> wrote: >>I am trying to create a semi-standalone with the vendor python on OS X >>10.4 (python 2.3.5). I tried to include some packages with both >>--packages from the

Re: Where is Python in the scheme of things?

2006-10-04 Thread James Stroud
t. > > What is particularly disappointing is the absence of a Windows IDE I'm a complete windows novice (as in I've forced myself to forget my experiences with it), but does windows not run vim? -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570

Re: Graph Theory

2006-10-05 Thread James Stroud
oc/python.html James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
= [get_pct(prompt) for prompt in prompts] sum_pcts = sum(pcts) if (sum_pcts > 100.0001) or (sum_pcts < 99.999): raise ValueError, "Values didn't add to 100." return pcts def get_pct(pct_type): pct = raw_input('Input percent of %s:' % pct_type) retur

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
James Stroud wrote: > sam wrote: > >> hi all, >> >> i'm starting to put together a program to simulate the performance of >> an investment portfolio in a monte carlo manner doing x thousand >> iterations and extracting data from the results. >> >

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
r: print "You messed up, try again." Now, all testing is done at the point where it is needed. There are no running totals that could cause accounting errors, your final data structure is an easy to use dict, unecessary tests have been eliminated, loops have been de-nested visually and logically, and, most importantly, the indentation level is kept manageable. I think you will be able to see how this latter code evolved from yours. I used to program just like you and it has taken me a few years to develop these little rules for tightening my code. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: error handling in user input: is this natural or just laborious

2006-10-06 Thread James Stroud
James Stroud wrote: > sam wrote: > >> this does what i want, though i don't like the inner while loop having >> to be there [snip] > A little cleaner. Now, lets tighten it up a bit more, and put nested > loops into functions. Im getting rid of keeping track of th

Re: Python to use a non open source bug tracker?

2006-10-07 Thread James Graham
Steve Holden wrote: > Giovanni Bajo wrote: > [...] >> >> I understand your concerns, but I have to remember you that most bug >> reports >> submitted by users go totally ignored for several years, or, better, >> forever. I >> do not have a correct statistic for this, but I'm confident that at >>

Re: Tkinter: Making a window disappear

2006-10-09 Thread James Stroud
> > -- > Claus Tondering > Maybe think about using the Toplevel.withdraw() method. This way you don't have to re-instantiate your window every time. This is the technique used by the PMW library. Use deiconify() to get it back. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

3D Vector Type Line-Drawing Program

2006-10-09 Thread James Stroud
would then like to set the camera and have the scene depicted as a line drawing (not ray-traced solid body, etc). Does anyone know of a library to do this? James James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ --

Re: 3D Vector Type Line-Drawing Program

2006-10-09 Thread James Stroud
James Stroud wrote: > Hello All, > > I'm looking for a program to do line-drawings in 3d, with output to > postscript or svg or pdf, etc. I would like to describe a scene with > certain 1-3d elements oriented in 3d space with dashed or colored lines > and filled or t

Re: Efficiently iterating over part of a list

2006-10-13 Thread James Stroud
in xrange(50) if not i%13] for i,item in alist: if i in special: do_something_special_with(item) else: do_other_stuff_with(item) James James -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficiently iterating over part of a list

2006-10-13 Thread James Stroud
James Stroud wrote: > Steven D'Aprano wrote: >> If I want to iterate over part of the list, the normal Python idiom is to >> do something like this: >> >> alist = range(50) >> # first item is special >> x = alist[0] >> # iterate over the rest of

Using SVN with Python and .pyc files

2006-10-13 Thread James Stroud
find files with the .pyc extension and delete those before every commit, or is there a more elegant way? It seems like a lot of wasted bandwidth an memory on the server side to constantly be dealing with these files that contain no real information. James -- http://mail.python.org/mailman/lis

Re: Using SVN with Python and .pyc files

2006-10-13 Thread James Stroud
Everyone wrote: [something helpful] Thank you to everyone for your responses. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Best Practice References

2006-10-13 Thread James Stroud
-- By all means, please start here: http://www.python.org/doc/essays/styleguide.html James -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse: add trailing text in help message?

2006-10-13 Thread James Stroud
e extra info here.' py> py> options, args = parser.parse_args() py> py> parser.print_help() Usage: dosomething [options] path Options: -h, --help show this help message and exit -a, --all don't skip hidden or binary files Some extra info here. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: A friendlier, sugarier lambda -- a proposal for Ruby-like blocks in python

2006-10-14 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi all -- > > Compared to the Python I know and love, Ruby isn't quite the same. > However, it has at least one terrific feature: "blocks". Whereas in > Python a > "block" is just several lines of locally-scoped-together code, in Ruby > a > "block" defines a closure (an

Re: creating many similar properties

2006-10-17 Thread James Stroud
b.bob0 128 py> b.bob1 128 py> b.bob1 = 258 py> b.bob1 2 py> b.bob3 128 py> dir(b) ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__'

Re: creating many similar properties

2006-10-18 Thread James Stroud
. That they wouldn't be seems an implementation bug and perhaps that bug should be fixed rather than promoting the avoidance of (2) because it does not create classes that behave as number (1). James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread James Stroud
ide symmetry for reversing any sequence (without requiring an iterator). (1,2,3).reversed() "123".reversed() [1,2,3].reversed() -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread James Stroud
Paul Boddie wrote: > James Stroud wrote: >>(1,2,3).reversed() >> >>"123".reversed() >> >>[1,2,3].reversed() > > I guess Python 2.5 has the reversed method of which you speak. Not that I could find (as methods of any built in sequence type). 2.5

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > > > without requiring an iterator > > can we perhaps invent some more arbitrary constraints while we're at it? > > > Why does it seem to me that you are confusing convienience with constraint, or are the two equi

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread James Stroud
Fredrik Lundh wrote: > James Stroud wrote: > > > without requiring an iterator > > can we perhaps invent some more arbitrary constraints while we're at it? > > > I guess while I'm at it, this thread wouldn't have so much steam were these idioms see

Re: Tkinter--does anyone use it for sophisticated GUI development?

2006-10-19 Thread James Stroud
t; paradigm to go with the new language I'm trying to learn? I had hoped to > reduce my learning curve, but I'm very concerned that I simply can't do > what I want to do with Tkinter. What do other Tkinter developers think? Its used in pymol. Also, look at my modest program a

Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread James Stroud
Neil Cerutti wrote: > On 2006-10-19, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >>James Stroud wrote: >> >> >>>without requiring an iterator >> >>can we perhaps invent some more arbitrary constraints while >>we're at it? > >

Re: Lead Software Engineer

2006-10-19 Thread James Stroud
s is just a cheap attempt at > getting free survey data. > > - alex23 > They would get more data if they lowered their expectations for the programmer position. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: help with my first use of a class

2006-10-19 Thread James Stroud
te_number = (random.randint(1, total_quotes[0]),) # Select a quote where the ID matches that number q = "SELECT Author, Quote FROM PythonQuoteQuery WHERE ID=?" c.execute (q, quote_number) quote = c.fetchone() # NOTE THE RETURN VALUE: return quote def print_quote(quote): # <== NOTE THE PARAMETER print quote # <== WHATEVER YOU WANT TO DO if __name__ == '__main__': if len(sys.argv) == 1: c = connect()# <== NO COLLISION: NAMESPACES quote = random_quote(c) # <== DITTO print_quote(quote) # THERE YOU HAVE IT James -- http://mail.python.org/mailman/listinfo/python-list

Re: help with my first use of a class

2006-10-20 Thread James Stroud
Fulvio wrote: > *** > Your mail has been scanned by InterScan MSS. > *** > > > On Friday 20 October 2006 14:34, James Stroud wrote: >> You really don't need classes for this > > I'm in that matter too. Does

Re: Want to reduce steps of an operation with dictionaries

2006-10-24 Thread James Stroud
oneously (for me) gets: > {'a': 0, 'c': 2, 'd': 3} > > Thanks for your help. > I think you have the right idea if I understand what you want: c = dict(((k,v) for (v,k) in enumerate(x for x in a if b.has_key(x -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list

<    6   7   8   9   10   11   12   13   14   15   >