Re: multiline strings and proper indentation/alignment

2006-05-09 Thread Gary Herron
Gary John Salerno wrote: How do you make a single string span multiple lines, but also allow yourself to indent the second (third, etc.) lines so that it lines up where you want it, without causing the newlines and tabs or spaces to be added to the string as well? Example (pretend this is all

Re: installing numpy

2006-05-09 Thread Gary Wessle
Raymond L. Buvel [EMAIL PROTECTED] writes: Gary Wessle wrote: Hi I am trying to install NumPy in my debian/testing linux 2.6.15-1-686. snip When installing from source on a Debian system, you want the installed package to wind up in /usr/local/lib/python2.x/site-packages (where

Re: Shadow Detection?

2006-05-09 Thread Gary Herron
Michael Yanowitz wrote: Hello: Many times, people are warning things like Don't use 'str' as a variable name as it will shadow the built in str function. Is there some way to determine if a string is already defined in some higher scope? Maybe something like code if isdefined ('str'):

Re: installing numpy

2006-05-10 Thread Gary Wessle
Robert Kern [EMAIL PROTECTED] writes: Raymond L. Buvel wrote: Since you are a new Linux user, you should definitely follow Robert's advice about building as an ordinary user separately from the install. I sometimes take a shortcut and just do the install as user root. However, I then

Re: combined files together

2006-05-10 Thread Gary Wessle
Eric Deveaud [EMAIL PROTECTED] writes: Gary Wessle wrote: I need to traverse those files in the order they were created chronologically. listdir() does not do it, is there a way besides build a list then list.sort(), then for element in list_of_files open element? are the name

Re: installing numpy

2006-05-10 Thread Gary Wessle
thanks I followed your suggestions, it built the package ok, while it was building, I noticed lots of lines going by the screen in groups of different colors, white, yellow, red. the red got my attention: Could not locate executable gfortran Could not locate executable f95

2 books for me

2006-05-11 Thread Gary Wessle
Hi I am about to order 2 books, and thought I should talk to you first. I am getting Python Cookbook by Alex Martelli, David Ascher, Anna Martelli Ravenscroft, Anna Martelli Ravenscroft, since Bruce Eckel's Thinking in Python is not finished and didn't have any new revisions since some time in

Re: find all index positions

2006-05-11 Thread Gary Herron
'1234'. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: find all index positions

2006-05-11 Thread Gary Herron
Paul Rubin wrote: [EMAIL PROTECTED] writes: say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the first occurence. I want to know the positions of both 1234

TkTable for info gathering

2006-05-12 Thread Gary Wessle
Hi I just finished with 1.5 tutorials about Tkinter, my thought is to use a table maybe TkTable to gather info from the user as to what file to chart data from, as well as info provided by the TkTable properties. each cell of the table will be either empty or contains a file path, let x=1 be

Re: Python Translation of C# DES Encryption

2006-05-12 Thread Gary Doades
://twhiteman.netfirms.com/des.html Regards, Gary. -- http://mail.python.org/mailman/listinfo/python-list

retain values between fun calls

2006-05-13 Thread Gary Wessle
Hi the second argument in the functions below suppose to retain its value between function calls, the first does, the second does not and I would like to know why it doesn't? and how to make it so it does? thanks # it does def f(a, L=[]): L.append(a) return L print f('a') print f('b')

copying files into one

2006-05-13 Thread Gary Wessle
Hi I am looping through a directory and appending all the files in one huge file, the codes below should give the same end results but are not, I don't understand why the first code is not doing it. thanks combined = open(outputFile, 'wb') for name in flist: if os.path.isdir(file):

continue out of a loop in pdb

2006-05-14 Thread Gary Wessle
Hi using the debugger, I happen to be on a line inside a loop, after looping few times with n and wanting to get out of the loop to the next line, I set a break point on a line after the loop structure and hit c, that does not continue out of the loop and stop at the break line, how is it down, I

Re: copying files into one

2006-05-14 Thread Gary Wessle
thanks, I was able 'using pdb' to fix the problem as per Edward's suggestion. -- http://mail.python.org/mailman/listinfo/python-list

Re: continue out of a loop in pdb

2006-05-14 Thread Gary Wessle
Paul McGuire [EMAIL PROTECTED] writes: Gary Wessle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi using the debugger, I happen to be on a line inside a loop, after looping few times with n and wanting to get out of the loop to the next line, I set a break point on a line

Re: Process forking on Windows

2006-05-17 Thread Gary Herron
for one process to start another. It provides a number of bells and whistles, and is the latest module on a long history of older modules to provide such functionality. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Process forking on Windows

2006-05-17 Thread Gary Herron
in the win32all package. However, I still don't understand *what* the MQSeries trigger monitor is or *how* it would create the need for such a solution. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

getting the value of an attribute from pdb

2006-05-17 Thread Gary Wessle
Hi how can I using pdb get a value of an attribute?, read the docs and played around with pdb 'p' for no avail. thanks class main: def __init__(self, master): self.master = master self.master.title('parent') self.master.geometry('200x150+300+225') ... root = Tk()

Re: Complex evaluation bug

2006-05-18 Thread Gary Herron
(repr(a)) to reproduce a, and in fact it does so. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: import woe

2006-05-18 Thread Gary Herron
[EMAIL PROTECTED] wrote: hello, i have a problem. i would like to import python files above and below my current directory. i'm working on /home/foo/bar/jar.py i would like to import /home/foo/car.py and /home/foo/bar/far.py how can i do this? thank you, bob ps: i

Re: who can give me the detailed introduction of re modle?

2006-05-19 Thread Gary Herron
failed, you will likely get lots of useful answers here. But you have to take the first step. P.S. The re module is really not all *that* difficult. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Tk.iconname still there?

2006-05-21 Thread Gary Wessle
Hi I am going through a tutorial on Tkinter http://doctormickey.com/python/pythontutorial_201.html, it referees to Tk.iconname() but I could not locate one after googleing and browsed and searched the Tkinter On-line reference material in the Tkinter reference: a GUI for Python, 84 pp. pdf from

Re: Why not just show the out-of-range index?

2006-12-03 Thread Gary Herron
not hold out much hope for that. Python and the whole open source movement is a volunteer effort by people who care enough to contribute. Your contributions would be welcome, but your complaints are likely to be ignored. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

error: Error -5 while decompressing data from struct.unpack

2006-12-14 Thread Gary Robinson
exception EINTR which is 5 -- but that's 5, not -5. Any help on this would be most appreciated. -- Gary Robinson CTO Emergent Music, LLC [EMAIL PROTECTED] 207-942-3463 Company: http://www.goombah.com Blog:http://www.garyrobinson.net -- http://mail.python.org/mailman/listinfo/python-list

Re: terminology question - foreign function library

2006-12-24 Thread Gary Herron
the need for building any extension module. Gary Herron Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: list/dictionary as case statement ?

2007-01-02 Thread Gary Herron
! ... x = fn y = [fn,fn] z = {1:fn, 2:fn} x() Hello world! y[0]() Hello world! y[1]() Hello world! z[1]() Hello world! z[2]() Hello world! Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run external program?

2007-01-12 Thread Gary Herron
. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create a linked list in Python?

2007-01-16 Thread Gary Herron
in a modern language. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: Capture traceback message to string?

2007-01-16 Thread Gary Herron
the basic components of the traceback message into strings. Here's what I want to do: The traceback module provides a wealth of ways to get at the exception information, formated and usable in various ways. See: http://docs.python.org/lib/module-traceback.html Gary Herron

selective logger disable/enable

2007-01-18 Thread Gary Jefferson
Suppose I have 3 modules that belong to a project, 'A', 'A.a' and 'B', and each module has its own logger, created with: module1logger = logging.getLogger('project.A') and module2logger = logging.getLogger('project.A.a') and module3logger = logging.getLogger('project.B') And I want to

Re: selective logger disable/enable

2007-01-20 Thread Gary Jefferson
, the poor programmer is forced to go and edit every module in the source tree to selectively turn on/off their respecitve loggers. Or am I missing something really obvious about how this is done with the logging module? thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: selective logger disable/enable

2007-01-21 Thread Gary Jefferson
enlighten me as to how to effectively use addFilter/removeFilter? many thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get self reference from within a module?

2007-01-22 Thread Gary Herron
which you can access and iterate through the names (keys) and values. If you want more capabilities, you should also look at the inspect module. Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman

Re: selective logger disable/enable

2007-01-22 Thread Gary Jefferson
, as MatchFilter (log_test18.py) seems to do what I was thinking I need the list of logger names for... most excellent. Thanks, Gary BTW, the python logging module is one of the best readily available loggers I've come across in any language. -- http://mail.python.org/mailman/listinfo/python

Re: How to use dynamic properties? -- Noob

2007-01-23 Thread Gary Herron
getattr(person, info_I_need) Related to getattr are setattr and hasattr. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variables

2007-01-24 Thread Gary Herron
function level static variables. However, I usually use module level attributes for such things. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variables

2007-01-24 Thread Gary Herron
function level static variables. However, I usually use module level attributes for such things. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

logging module and doctest

2007-01-24 Thread Gary Jefferson
does something with logging. Is there any way to make these work together? Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: selective logger disable/enable

2007-01-24 Thread Gary Jefferson
it for just getting client or server msgs), etc. So I would really like to figure out how to do 'a.*.c'. Any ideas? Thanks again, Gary On Jan 23, 3:01 am, Vinay Sajip [EMAIL PROTECTED] wrote: Glad the tests/examples (log_testxx.py) helped. When I get a chance, I will try to work some of them

Re: logging module and doctest

2007-01-25 Thread Gary Jefferson
Peter Otten wrote: Peter Otten wrote: Gary Jefferson wrote: I've written a logging.filter and would like to use doctest on it (using a StreamHandler for stdout), but this doesn't seem possible. Output from the logger seems to disappear (running the doctest strings through

Re: selective logger disable/enable

2007-01-25 Thread Gary Jefferson
Gary Jefferson wrote: So maybe I don't have all this figured out quite as well as I thought. What I really want to do is set an environment variable, MYDEBUG, which contains a list of wildcarded logger names, such as a.*.c a.d (which becomes ['a.*.c', 'a.d'], and then selectively crank

Re: how to remove c++ comments from a cpp file?

2007-01-26 Thread Gary Herron
I fear your regular expression is incorrect. Cheers, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: PY Zip

2007-01-30 Thread Gary Herron
. Is there a ZIP utilty already stored with a basic PYTHON download? Thanks all. The module you want is called zipfile, and its part of the standard library. See: http://docs.python.org/lib/module-zipfile.html for documentation. Gary Herron -- http://mail.python.org/mailman/listinfo/python

Re: win32com.client

2007-01-31 Thread Gary Herron
vithi wrote: Hi Any one tell me where I can get (or download) python modules win32com or win32com.client because I have to use Dispatch thanks You want the python for windows extension, available from http://sourceforge.net/projects/pywin32/ Gary Herron -- http://mail.python.org

Re: Simple SVN/CVS-like library in Python?

2007-02-07 Thread Gary Herron
it's scritable from Python so you can automate some tasks if you wish. Gary Herron Thank you very much for every hint. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings in Python

2007-02-08 Thread Gary Herron
put your find in a loop, starting the search one past the previously found occurrence. i = string.find(mystring, i+1) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: UNIX shell in Python?

2007-02-09 Thread Gary Herron
, Deniz Dogan Not only *can* it be done, but it *has* been done and well: See IPython at: http://ipython.scipy.org/moin/ Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm faint why this can't work

2007-02-16 Thread Gary Herron
being imported is not the one you printed? (Run Python with a -v switch to test for this possibility.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing from upper directory

2007-02-17 Thread Gary Herron
sys.append(path2) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is more efficient?

2007-02-18 Thread Gary Herron
. The number of methods/functions may slow things up, but it will affect either name space equally. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Declare a variable global

2007-02-19 Thread Gary Herron
your code to not rely on the global statement. Do something like this if you can: def test(): return 123 colorIndex = test() Gary Herron My question is why do I have to explicit declaring 'global' for 'colorIndex'? Can't python automatically looks in the global scope when i access

Re: How can I disable a device in windows using python

2007-02-26 Thread Gary Herron
, we'll see if we can find a way to do it from within Python. Things you might want to tell us: What OS. What device(s) Exactly what disable means for each. How the OS allows you to enable/disable each. Anything else that might help us. Gary Herron -- http://mail.python.org/mailman/listinfo

Re: import parent

2007-02-27 Thread Gary Herron
imports are often a sign that your software design is not very well thought out. It's usually better to have your thought process, your design and your imports organized in a hierarchal fashion. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle Problem

2007-03-15 Thread Gary Herron
tonyr1988 wrote: I'm a complete python n00b writing my first program (or attempting to, anyway). I'm trying to make the transition from Java, so if you could help me, it would be greatly appreciated. Here's the code I'm stuck on (It's very basic): class DemoClass: def __init__(self):

Re: distributing python software in jar like fashion

2007-03-16 Thread Gary Duzan
://groups.google.com/groups/search?q=group%3Acomp.lang.python+squisherqt_s=Search Gary Duzan Motorola CHS -- http://mail.python.org/mailman/listinfo/python-list

Re: distributing python software in jar like fashion

2007-03-17 Thread Gary Duzan
to be installed on the remote site, and just one file to copy. Gary Duzan Motorola CHS -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding local variable declarations?

2008-11-13 Thread Gary Herron
] or ... probably other ways can be found ... but what's wrong with you original code? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: find() a larger string within a smaller string

2008-11-14 Thread Gary Herron
. (And then the problem will most likely be in your expectations, not in the find method.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: initialized list: strange behavior

2008-11-24 Thread Gary Herron
here to obscure things. Try this: Here b is a list that contains three references to a. Modify a, and all three references to a show the modification: a = [1,2,3] b = [a,a,a] a.append(4) b [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]] Gary Herron nn=3*[[]] nn

Re: How to pass out the result from iterated function

2008-12-10 Thread Gary Herron
So either way, *something* is returned, and in the case of the recursive call, the innermost result is returned back up through all levels of the recursion. Is that what you wanted? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Generator slower than iterator?

2008-12-16 Thread Gary Herron
Lie Ryan wrote: On Tue, 16 Dec 2008 12:07:14 -0300, Federico Moreira wrote: Hi all, Im parsing a 4.1GB apache log to have stats about how many times an ip request something from the server. The first design of the algorithm was for line in fileinput.input(sys.argv[1:]): ip =

Re: Reverse order of bit in repeating seqence of byte string

2009-01-02 Thread Gary Herron
)# Reinterpret as a ?? by 3 array b=a[...,::-1] # reverse the second dimension print b.tostring() # Convert back to a string. rgbRGBabcABC Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is ''r'' in python?

2009-01-06 Thread Gary Herron
' 'a' u'b' u'ab' So there you have it. Your mystery is the (automatic) concatenation of two empty strings. Gary Herron Regards, Harish -- http://mail.python.org/mailman/listinfo/python-list -- http

Python Startup file

2009-01-16 Thread Gary Smith
to me Gary _ Accept no assertions without evidence. --Goompah wisdom from Omega by Jack McDevitt-- _ Nature is complete because it does not serve itself. --Tao De Jing by Lao Tze-- -- http://mail.python.org/mailman/listinfo/python-list

Re: var is None vs. var == None

2009-01-23 Thread Gary Herron
, but rather it is a (singleton) object that can be referenced. Setting something *equal* to None is accomplished by making it refer to the single None object, at which point it *is* None. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-01-29 Thread Gary Herron
definition suggests) object-fascist. We use objects to great effect in Python, when it is natural to do so, but the language does not force it on us. Gary Herron -- Regards, Maneesh KB Comat Technologies Bangalore Mob: 9740-192309 We work with the underprivileged and in rural

Re: Rounding to the nearest 5

2009-01-30 Thread Gary Herron
todp...@hotmail.com wrote: How can you make python round numbers to the nearest 5: Example: 3 = 0 8 = 10 23.2 = 20 36 = 35 51.5 = 50 round(n,-1) rounds to the nearest 10, so round(n*2,-1)/2 will round to the nearest five. Gary Herron Thanks

Re: Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Gary Duzan
. Gary Duzan -- http://mail.python.org/mailman/listinfo/python-list

Re: Import Replacement

2009-01-31 Thread Gary Herron
of its own name, but the classes have identical interfaces, then try if ...: from horse import Horse as Ridable else: from buffalo import Buffalo as Ridable # Then instantiate animal = Ridable(...) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Global State

2009-02-03 Thread Gary Herron
that will work. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Use list name as string

2009-02-04 Thread Gary Herron
Vincent Davis wrote: Do to laking knowledge my google searches have not turned up an answer for me. I know this is wrong it uses the items in the list as the filename, how do I refer to the dataname and not the items in it. def savedata(dataname): filename = str(dataname) # this does

Re: Couple of noobish question

2009-02-04 Thread Gary Herron
like this: import a ob = UsefulClass(...) a.UsefulFn() Good luck, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: SuPy - Script Sketchup with Python

2009-02-06 Thread Gary Herron
greg wrote: SuPy 1.0 SuPy is a plugin for the Sketchup 3D modelling application that lets you script it in Python. http://www.cosc.canterbury.ac.nz/SuPy/ That URL fails with a 404 - not found. (At least for me at this moment in time.) This is a first version and is highly

Re: Best 3d graphics kit for CAD program???

2009-02-08 Thread Gary Herron
for Python. pyglet provides an object-oriented programming interface for developing games and other visually-rich applications for Windows, Mac OS X and Linux. You might also consider SDL and its python bindings. Gary Herron Thanks Guy's -- http://mail.python.org/mailman/listinfo

Re: Best 3d graphics kit for CAD program???

2009-02-08 Thread Gary Herron
n...@stinemates.org wrote: Gary Your email client is set to HTML mode and looks terrible for those of us who prefer plain view. It also appears your client is not properly sending your message in text/plain encoding. -- http://mail.python.org/mailman/listinfo/python-list Understood

Re: how to find out vesion of a python module

2009-02-09 Thread Gary Herron
could I fix this? It looks like you have it installed incorrectly, How did you install it. What platform/system are you on? PIL usually uses a PIL.pth file. Does that exist? Where? And what are its contents? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

python3 tutorial for newbie

2009-02-10 Thread Gary Wood
Can someone recommend a good tutorial for Python 3, ideally that has tasks or assignments at the end of each chapter. Please, -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2009-02-19 Thread Gary Wood
I'm stuck on a tutorial Hands on Python3 Exercise 1.13.7.3. ** Complete the following function. This starting code is in joinAllStub.py. Save it to the new name joinAll.py. Note the way an example is given in the documentation string. It simulates the use of the function in the Shell. This is

Re: list comprehension problem

2009-10-29 Thread Gary Herron
. And you do want an equality check here. Gary Herron Regards, mk -- http://mail.python.org/mailman/listinfo/python-list

Re: How convert string '1e7' to an integer?

2009-11-07 Thread Gary Herron
the ability of a float: int(float('1e20')) 1L int(float('1e30')) 119884624838656L Gary Herron I'm wondering what function to use to convert '1e7' to an integer? int('1e7') int(1e7) 1000 Traceback (most recent

Re: Pause a script before termination

2009-11-11 Thread Gary Herron
noydb wrote: Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end. How can this be accomplished? Thanks! If your IO is to/from a command line window, try this: raw_input('Hit ENTER to exit: ') Gary

Re: overriding __getitem__ for a subclass of dict

2009-11-15 Thread Gary Herron
:41) [GCC 4.3.3] al NEW AND IMPROVED AL! bob bob It's the difference between old-style and new-style classes. Type dict and therefore OnlyBob are new style. OnlyAl defaults to old-style. If you derive OnlyAl from type object, you'll get consistent results. Gary Herron

Re: Line Breaks

2009-11-23 Thread Gary Herron
identify and solve the real problem you're having. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Line Breaks

2009-11-23 Thread Gary Herron
Susan Day wrote: On Mon, Nov 23, 2009 at 2:26 PM, Gary Herron gher...@islandtraining.com mailto:gher...@islandtraining.com wrote: print 'A Message From %s:\n\n %s' % ('someone','some message') A Message From someone: some message So... *Exactly* what are you doing with msg

Re: Unpacking Tuples

2009-11-30 Thread Gary Herron
) what version does it start with? 1) Syntax is just as you have it. (Not including the period you have at the end.) 2) Python 3.0 Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python

2009-11-30 Thread Gary Herron
word struct, let's start with this: Python has a module named struct: http://docs.python.org/library/struct.html#module-struct Is that what you wanted? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: insert unique data in a list

2009-12-13 Thread Gary Herron
is important, you could use a set -- where a second insertion will have no effect. s = set() s.add(1) s.add(2) s.add(1) print s set([1, 2]) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: insert unique data in a list

2009-12-13 Thread Gary Herron
mattia wrote: Il Sun, 13 Dec 2009 16:37:20 +, mattia ha scritto: How can I insert non-duplicate data in a list? I mean, is there a particular option in the creation of a list that permit me not to use something like: def append_unique(l, val): if val not in l: l.append(val)

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Gary Herron
Dotan Barak wrote: Hi. I'm trying to evaluate a string and getting a NameError (it is expected, since the variable my_number wasn't provided in the locals dictionary). --snip start-- eval(my_number 10, {__builtins__:None}, {}) Traceback (most recent call last): File stdin, line 1, in ?

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-25 Thread Gary Herron
Dotan Barak wrote: On 25/12/2009 19:27, Gary Herron wrote: Dotan Barak wrote: Recover the exception, and examine the tuple of args or the message string. try: ... eval(my_number 10, {__builtins__:None}, {}) ... except NameError,e: ... print e.args ... print

Re: Do I have to use threads?

2010-01-05 Thread Gary Herron
simultaneously. See http://docs.python.org/library/asyncore.html Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: from datetime.datetime import today not working. python2.6.4 on windows

2010-01-06 Thread Gary Herron
this: import datetime today = datetime.datetime.today or from datetime import datetime today = datetime.today Then you'll be able to call today() at any time. Gary Herron Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy Q

2010-01-09 Thread Gary Herron
of the string if it's a string and the length of the list if it's a list. TIA, beno Like this: if isinstance(var, list): ... join ... else: ... ??? ... Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: how to duplicate array entries

2010-01-10 Thread Gary Herron
be clearer to some. x = [1,2,3] print [ifor i in xfor k in range(3)] [1, 1, 1, 2, 2, 2, 3, 3, 3] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: import data structure

2010-01-15 Thread Gary Herron
print x or from sfdata import author_list # Import individual attribute from module. for x in author_list: print x Gary Herron FILE: sfdata.py (i'm trying to import it) == author_list = { '829337

Re: What is a list compression in Python?

2010-01-18 Thread Gary Herron
is more efficient than x**2. So. print [x**2 for x in xrange(1,11,2)] Gary Herron Kit. On 1月19日, 上午12時30分, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Mon, 18 Jan 2010 08:07:41 -0800, Kit wrote: Hello Everyone, I am not sure if I have posted this question

Re: Interesting Problem

2010-01-20 Thread Gary Herron
as normal. * Check out the imp module which allows you to import from files specified via a path. Straighten that out, then we can examine the following (suspicious) clams: * that you must evaluate *before* some import * that you must use globals * python's problem with globals Gary Herron cwd

Re: Accessing the name of an actual parameter

2010-01-26 Thread Gary Herron
It's naive to think this question even makes sense. There are many ways f can be called which don't involve a parameter: f(42) f(time()) f(a+123) f(sin(a)) f(f(1)) and so on. Cheers, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing the name of an actual parameter

2010-01-26 Thread Gary Herron
Gary Herron wrote: Hellmut Weber wrote: Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__

<    1   2   3   4   5   6   7   8   9   10   >