Re: Basic question

2007-05-12 Thread Gary Herron
Cesar G. Miguel wrote: > I've been studying python for 2 weeks now and got stucked in the > following problem: > > for j in range(10): > print j > if(True): >j=j+2 >print 'interno',j > > What happens is that "j=j+2" inside IF does not change the loop > counter ("j") as it would

Re: Splitting a string

2007-05-15 Thread Gary Herron
t; title="Send an Email to selected ... employee">''' >>> print s 'D132258','', 'status=no,location=no,width=630,height=550,left=200,top=100')" target="_blank" class="dvLink" title="Send an Email to selected employee"> >>> s.find('\\') -1 So the question now becomes: Where do you really want to split it? If at the comma then one of these will work for you: >>> print s.split(',')[0] 'D132258' >>> i = s.index(',') >>> print s[:i] 'D132258' Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: removing common elemets in a list

2007-05-15 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hi, > Suppose i have a list v which collects some numbers,how do i > remove the common elements from it ,without using the set() opeartor. > Thanks > > Several ways, but probably not as efficient as using a set

Re: Key Listeners

2007-05-29 Thread Gary Herron
an event when the keyboard is used. ) Yes, every GUI I've ever used from Python (Tk/Tcl, wxPython, Gtk++, Win32 API, ...) has a way to catch keyboard events. But you're going to have to tell us which OS and which GUI you're interested in before you get a more detailed a

Re: Rats! vararg assignments don't work

2007-05-29 Thread Gary Herron
everal better options: For instance: for arg in moreargs: # Loop through each arg or for i in range(len(moreargs)): # Extract ith arg or argslist = list(moreargs) while argslist: firstarg = argslist.pop(0) # Extract first arg Gary Herron > Second, is there any good r

Re: How can an Exception pass over an "except" clause ?

2007-05-30 Thread Gary Herron
AttributeError = SyntaxError Then your code will be will produce a real AttributeError, but miss it because (despite the spelling) it checks for a SyntaxError, Question... I don't know what contract.py is, but could it be doing something that *bad*? You could check py printing Attribut

Re: question about math module notation

2007-07-26 Thread Gary Herron
4407369744.000 >>> print '%12.5e' % x 1.84467e+19 >>> print '%12.5g' % x 1.8447e+19 See http://docs.python.org/lib/typesseq-strings.html for all he details. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Imported globals?

2007-07-27 Thread Gary Herron
import module_a from module_a import change_value but that's probably confusing and generally considered a bad idea. Ideas: 1 If you want module_a to manage such a global variable, you could include functions for getting, and setting it, as well as your function for changing it's value. 2. You could also dispense with use of global values -- various OOP techniques could help there. Gary Herron > Thanks! > > Cheers, > Valia > > -- http://mail.python.org/mailman/listinfo/python-list

Re: this must be a stupid question ...

2007-07-28 Thread Gary Herron
it probably has some special meaning. > > thanks, > Stef Mientki > The $ is not used in any Python syntax. Neither in variable names nor any syntactical construct. Of course, like any character, it can be used in strings. (And some packages, like re, will make special use of a $ i

Re: File handle not being released by close

2007-07-31 Thread Gary Duzan
t;f=open(fileBeginning+".tmp", 'w') >f.write("Hello") >f.close f.close() Gary Duzan Motorola CHS -- http://mail.python.org/mailman/listinfo/python-list

Re: sending very large packets over the network

2007-08-01 Thread Gary Herron
ou. It fails to across the internet (sometimes) and when (at least some) wireless cards are involved. You may be better off using a package that knows all this and handles it properly. Modules asyncore and asynchat are one possibility. Gary Herron > > the sample code is as follows >

Re: a dict trick

2007-08-02 Thread Gary Herron
may also want to checkout the dictionary method setdefault which has the functionality of get PLUS if the key is not found, it adds the key,value pair to the dictionary. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Question -- Running Programming Python Examples

2007-08-04 Thread Gary Herron
rt 8080 with url's that look like this: http://localhost:8080/what/ever/..., or http://machine-name:8080/what/ever/..., Gary Herron > > > import os, sys > > from BaseHTTPServer import HTTPServer > > from CGIHTTPServer import CGIHTTPRequestHandler

Re: JPype - passing to Java main

2007-08-15 Thread Gary Duzan
p:121 >--END ERROR- > >Thanks, >Sarah Just a guess, but try com.JPypeTest.main(["arg"]). Gary Duzan Motorola HNM >On Aug 14, 8:03 am, Laurent Pointal <[EMAIL PROTECTED]&g

Re: python socket usage

2007-08-16 Thread Gary Herron
#x27;) If you want to turn a string representation of an object back into an object, you must eval the string. Moreover, if the tuple contains things other than simple integers (float of strings of whatever) the string represtnataion of the object may not be able to recover the original object accu

Re: python socket usage

2007-08-16 Thread Gary Herron
Oğuz Yarımtepe wrote: > On Thursday 16 August 2007 11:20:38 Gary Herron wrote: > >> If you really want to send any Python object through a socket, look up >> the Pickle and cPickle modules. These will marshal (as it's called) any >> Python object of any type and

Re: A problem with Time

2007-08-16 Thread Gary Herron
ays date? > > Thank You > > Dominic > > > Here's how I'd do it: >>> import time >>> secondsPerDay = 24*60*60 >>> today = time.time() >>> yesterday = today - secondsPerDay >>> print time.strftime("%d%m%Y",time.lo

Re: sort dictionary by specific values

2007-08-18 Thread Gary Herron
CANNOT sort a (standard Python) dictionary. You CAN find some alternative implements of dictionaries on the web that allow ordering, and you CAN extract the key,value pairs from a dictionary into a list, and sort that list (by any criteria you want). Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: "Variable variable name" or "variable lvalue"

2007-08-19 Thread Gary Herron
"self.%s = '%s'" % (item, plist[item]) > Yuck! Not at all necessary. Use setattr instead: setattr(self, item, plist[item]) That's much cleaner then an exec or eval. You may also find getattr and hasattr useful. Gary Herron > A more simple example for setting a variable outside of a class... > > exec '%s = '%s'" % ('variableName', 'variable value') > > Cheers! > Mike > > -- http://mail.python.org/mailman/listinfo/python-list

Re: How to setup pyOpenGL3.0.a6 for window xp?

2007-08-19 Thread Gary Herron
imple (nice, very small, well featured and consistent) widget toolkit with OpenGL support. Once the window is open, PyOpenGL (versions 2xx or 3xx) work perfectly on the window. See http://www.fltk.org/ Gary Herron >> However, it doesn't (easily) work with common GUIs like GTK and Wx.

Re: Python Path Dictionary

2007-08-21 Thread Gary Herron
27;/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/gtk-2.0'] >>> import sys >>> sys.path ['', 'C:\\WINDOWS\\system32\\python24.zip', 'C:\\cygwin\\home\\Gary', &#

Re: Python is removing my quotes!

2007-08-21 Thread Gary Herron
ot Python. It never even sees those quotes. Whatever system you are using for entering the text is stripping them. Is it the command prompt (cmd.exe)? If so then you can escape the quote by preceding it with a backslash. (This is true of the DOS prompt and all the unix shells, and their window

Re: My 'time' module is broken, unsure of cause

2007-08-23 Thread Gary Herron
darren kirby wrote: > Hi all, > > I have a strange error here and I am unsure how to further investigate it: > > Python 2.4.4 (#1, Aug 23 2007, 10:51:29) > [GCC 4.1.2 (Gentoo 4.1.2)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > import time

Re: strings (dollar.cents) into floats

2007-08-30 Thread Gary Herron
n empty string. And that would seem to mean you have an empty line in your input. So... Either remove the empty lines, or test my_line before calling float on it. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get a formatted string?

2007-09-04 Thread Gary Herron
Ginger wrote: > like format function in Visual Basic, > format("##.##%",0.3456) ==>> 34.56% > "%5.2f%%" % (0.3456*100) '34.56%' See this section of the manual: http://docs.python.org/lib/typesseq-strings.html Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

getting the current function

2007-09-06 Thread Gary Robinson
ere since thisfunc() stores the references on the stack rather than the heap. But I'm not sure. Obviously, it would be easy to add a try/finally with appropriate del's, but I don't want to do it if it's not necessary. I welcome feedback of any type. Thanks, Gary -- Gary Ro

Re: Getting original working directory

2007-09-06 Thread Gary Herron
() returns the current working directory. Call this before you change things with os.chdir(). Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting original working directory

2007-09-06 Thread Gary Herron
you saying you *CAN'T* call getcwd and save the value before you call chdir, and that you *MUST* recover the original working directory *AFTER* you change it. I don't believe it... and won't waste my time trying to solve such a silly problem until you demonstrate that you ca

re: getting the current function

2007-09-07 Thread Gary Robinson
isn't one of them, I just used that as a quick example of using thisfunc(). I've just never liked the fact that you have to name the function when accessing those attributes from within the function. And I thought there might be other uses for something like thisfunc(). -- G

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__(s

Re: distributing python software in jar like fashion

2007-03-16 Thread Gary Duzan
actly what you want Real Soon Now. http://groups.google.com/groups/search?q=group%3Acomp.lang.python+squisher&qt_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
ot; to execute it, with no need for anything but the base Python 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: making objects with individual attributes!

2007-03-20 Thread Gary Herron
t; a different > "set" > Of course. Try this: class document: def __init__(self, string): self.titre = string self.haveWords = set() Each instance creation will call __init__ with the instance accessible through self, and that code will create two instance specific attribute

Re: Make variable global

2007-03-21 Thread Gary Herron
procedure go is defined in a.py, the global blah it refers to is global to that module. So import a (instead of importing * from a) and try this: >>> import a >>> a.blah >>> a.go() >>> a.blah 5 >>> Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access multiple group matches?

2007-04-06 Thread Gary Herron
behaviour isn't desired; if the RE <.*> is matched against |'title'|, it will match the entire string, and not just |''|. Adding "?" after the qualifier makes it perform the match in /non-greedy/ or /minimal/ fashion; as /few/ characters as possi

Re: Checking whether list element exists

2007-04-07 Thread Gary Herron
ther's be reported as the errors they are: try: myList[index] except IndexError: ...whatever... Gary Herron > Is it ok to use try...except for the test or is it bad coding style? Or > is there another, more elegant method than these two? > > Regards, > Rehceb > -- http://mail.python.org/mailman/listinfo/python-list

PIL DPI trouble

2007-09-13 Thread Gary Bloom
those same two programs can't read the DPI as set by them. Is there a workaround for this? Other than this one issue, I have found the PIL to be a BLAST! :) Thanks! Gary Bloom-- http://mail.python.org/mailman/listinfo/python-list

distutils, extensions, and missing headers

2007-09-19 Thread Gary Jefferson
h these header files present, but they still don't get put in the tarball. What's the key to getting headers or other [non-python] files included in a bdist? Thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils, extensions, and missing headers

2007-09-20 Thread Gary Jefferson
you can live with package data), use > "data_files": > > http://docs.python.org/dist/node13.html I also tried using data_files to get the headers included, but can't seem to get that to work either. No errors are reported for either method. Thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: An Editor that Skips to the End of a Def

2007-09-20 Thread Gary Coulbourne
John J. Lee wrote: > Eclipse must be able to do this. Not by default... but I am certain there are plugins that provide python integration. (And jython integration) Peace, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: distutils, extensions, and missing headers

2007-09-20 Thread Gary Jefferson
On Sep 20, 12:08 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Gary Jefferson wrote: > > On Sep 20, 1:22 am, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Use the "headers" keyword to setup() to list theheaderfiles you want > >> installed. > >

calling extension's autoconf/make from distutils

2007-09-20 Thread Gary Jefferson
to have done './ configure' first, as it untars and tries to build the extension there. Is there a hook for bdist_rpm (and friends) that will allow me to insert a './configure' in the build process, sometime before it tries to build the extension? Thanks, Gary -- http://mail.python.org/mailman/listinfo/python-list

Re: calling extension's autoconf/make from distutils

2007-09-21 Thread Gary Jefferson
On Sep 20, 10:43 pm, Gary Jefferson <[EMAIL PROTECTED]> wrote: > I've got a python extension that comes with its own standard autoconf/ > automake system, and I can "python setup.py build" just fine with it > as long as I have previously done "./configure"

Re: True of False

2007-09-27 Thread Gary Herron
Richard Thomas wrote: > On 27/09/2007, Casey <[EMAIL PROTECTED]> wrote: > >> On Sep 27, 12:48 pm, "Simon Brunning" <[EMAIL PROTECTED]> >> wrote: >> >>> On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> >>> I tried writing a true and false If statement and didn't get >

Re: marshal bug?

2007-09-28 Thread Gary Herron
t the module uses. Version 0 is the historical format, version 1 (added in Python 2.4) shares interned strings and version 2 (added in Python 2.5) uses a binary format for floating point numbers. The current version is 2 Gary Herron. -- http://mail.python.org/mailman/listinfo/python-list

Re: Delete spaces

2007-09-28 Thread Gary Herron
lit() >>> print f ['1', '1', '10:55:14', '2', '65', '8.5'] >>> ','.join(f) '1,1,10:55:14,2,65,8.5' or >>> ', '.join(f) '1, 1, 10:55:14, 2, 65, 8.5' >>> Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Combine two dictionary...

2007-10-04 Thread Gary Coulbourne
ly ask for an element in the list. -- Gary CoulbourneSoftware Developer C/C++, Java, Perl, Python -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbi Q: Recursively reverse lists but NOT strings?

2007-10-14 Thread Gary Herron
sed copy of either a string or a list Your recursion stops when xs == [], but when you're stripping characters off a string, like 'abc', the remaining portion will be 'bc', then 'c', than '', but never [] so you 'll never stop. Try: if xs == []: return [] elif xs == '': return '' else: ... Gary Herron > > Thanks, > Dima -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbi Q: Recursively reverse lists but NOT strings?

2007-10-15 Thread Gary Herron
Dmitri O.Kondratiev wrote: > Gary, thanks for lots of info! > Python strings are not lists! I got it now. That's a pity, I need two > different functions: one to reverse a list and one to reverse a string: True, they are not both lists, but they *are* both sequences, with some th

Re: Speed of Nested Functions & Lambda Expressions

2007-10-23 Thread Gary Herron
of Python while executing fn_outer, the def of fn_inner looks just like an assignment with fn_inner as the variable name and a code object as the value. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find if a string contains another string

2007-10-29 Thread Gary Herron
perator named in: >>> bigstring="python anaconda boa cobra" >>> smallone="boa" >>> smallone in bigstring True Often used in if statements like this: >>> if smallone in bigstring: ... print 'contained' ... else: ... print '

Re: Print a list to a string?

2007-10-31 Thread Gary Herron
tation of that object. Use str for a human friendlier representation, and repr for a more explicit representation. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run external program?

2007-01-12 Thread Gary Herron
and both its input and output. 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
off if you can use Python's list data structure rather than try to emulate an outdated concept 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
#x27;t seem to figure out how to get 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

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 select

Re: selective logger disable/enable

2007-01-20 Thread Gary Jefferson
component, by providing, for example, a command line switch or environment variable. Otherwise, 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

Re: selective logger disable/enable

2007-01-21 Thread Gary Jefferson
oximate squelching of everything but that which I explicitly setLevel (which does inherit properly). In other words, the addFilter/removeFilter part of the API seems rather impotent if it can't be inherited in the logging namespaces. In fact, I can't really figure out a use case where I could possibly want to use it without it inheriting. Obviously I'm missing something. I'm sure I've consumed more attention that I deserve already in this thread, but, do you have any pointers which can 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
dictionary of all objects in the module, from 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 Tech

Re: selective logger disable/enable

2007-01-22 Thread Gary Jefferson
s)? Or... maybe I don't need this, either, 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. -- ht

Re: How to use dynamic properties? <-- Noob

2007-01-23 Thread Gary Herron
plete Web Services > http://www.datafly.net > > Like this: info_I_need = 'name' print 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
ibutes that can be used like 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
ibutes that can be used like 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
se doctest 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
exactly what I want. Other times, I want only smtp DEBUG msgs, and the hierarchy won't help me get that (unless I break 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, "

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

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'

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

2007-01-26 Thread Gary Herron
returns a new string which you must assign to something: new_data = r.sub(ur"", data) Then do something with the new string. Also 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
to be able to be used in Python Win. 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 Her

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/proje

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

2007-02-07 Thread Gary Herron
's got far more feature than you're likely to get into any Python scripts in the near future. (Plus 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 T

Re: Strings in Python

2007-02-08 Thread Gary Herron
tring sub is found, 4 such that sub is contained within s[start,end]. Optional 5 arguments start and end are interpreted as in slice notation. 6 7 Return -1 on failure. So 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
parsing user input. > > Regards, > 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
tabs for the indentation, so that the code Python sees is not as we see it printed? (Don't ever do that.) Do you have several copies of sampdict.py (or even sampdict.pyc) so that the copy 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
h.split(path0)[0] # Up one path2 = os.path.split(path1)[0] # Up two sys.append(path2) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: What is more efficient?

2007-02-18 Thread Gary Herron
is highly optimized and probably not noticeable. 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
colorIndex colorIndex=123 # changes the value of the global Better yet, restructure 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 declari

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

2007-02-26 Thread Gary Herron
ever, if you tell us how you would disable a card from outside of Python, 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. Anythi

Re: import parent

2007-02-27 Thread Gary Herron
s have pointed out, circular 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: Variable-width lookbehind

2007-11-18 Thread Gary Herron
e reason enough for some to want to keep it out.) But this is an all volunteer community. Your feature is not in the language because no one has cared enough to implement it. Or if some one has implemented it, no one has found it useful enough to lobby it into the language. Are

Re: Unexpected behavior when initializing class

2007-11-28 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hello everybody, > > I've banged my ahead around for a while trying to figure out why > multiple instances of a class share the same instance variable. I've > stripped down my code to the following, which reproduces my problem. > This is a *feature* of Python tha

Re: "Python" is not a good name, should rename to "Athon"

2007-12-03 Thread Gary Herron
Russ P. wrote: > On Dec 3, 8:22 am, [EMAIL PROTECTED] wrote: > >> The only reason to change the name would be because of some serious >> bad PR that came onto Python, thus causing its branding name to be >> catagorized as something bad. >> >> However this is not the case, presently, and the bran

Re: Python Class Best Practice

2007-12-04 Thread Gary Herron
If you *really* wanted two class members *AND* two instance members with the same names, (WHY???) then example 1 will do so, but you'll have to access the instance members as self.member1 and the class members as Foo.member1. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: UliPad 3.8.1 released!

2007-12-12 Thread Gary Herron
e time, when making such an announcement, to tell us *what* it is you are releasing. Just a sentence or two and a URL would be only common courtesy. Thanks, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: what the heck does this mean?

2007-12-13 Thread Gary Herron
ans "save"? What is "randomletters"? The error you are getting is usually gotten by code that tries to treat a variable containing a list as a function. Example: someList = [1,2,3] someList(99) Traceback (most recent call last): File "", line 1, in TypeError:

Re: Loops and things

2007-12-14 Thread Gary Herron
h values from each iterator respectively, and loop on that: >>> for i,j in zip(range(10),range(10,20)): ... print i,j ... 0 10 1 11 2 12 3 13 4 14 5 15 6 16 7 17 8 18 9 19 Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: simple string formatting question

2007-12-14 Thread Gary Herron
and use join on a space to the the space delimited string. >>> theList = ['./whatever', 'a', 'b', 'c'] >>> print ' '.join([repr(i) for i in theList]) './whatever' 'a' 'b' 'c' Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: opposite of zip()?

2007-12-14 Thread Gary Herron
nks, > igor > But it *does* exist, and its named list.append, and it works as you wanted. >>> list.append >>> a = [[],[]] >>> map(list.append, a, (1,2)) [None, None] >>> a [[1], [2]] >>> map(list.append, a, (3,4)) [None, None] >>&

Re: opposite of zip()?

2007-12-15 Thread Gary Herron
[EMAIL PROTECTED] wrote: > Hi folks, > > Thanks, for all the help. I tried running the various options, and > here is what I found: > > > from array import array > from time import time > > def f1(recs, cols): > for r in recs: > for i,v in enumerate(r): > cols[i].append(v) >

Re: [newbie] Read file, and append?

2007-12-25 Thread Gary Herron
ot;activate.tmpl", "rb") template = "\r\n" + f.read() f.close() for fname in glob.glob('*.frm'): inf = open(fname, "rb") content = inf.read() inf.close() if 'Form_Activate' not in content: print "Not in", fname outf = open(fname, 'wb') outf.write(content) outf.write(template) outf.close() Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Plug-Ins In A Python Application

2006-04-18 Thread Gary Herron
look* like a declaration, but in fact it may be executed anywhere. The import statements does, however, hard code its module's name. For a plugin system, you'll probably want to import a module given a string containing its name. The "imp" module provides this as w

Re: extracting a substring

2006-04-18 Thread Gary Herron
quot;a53bc_([0-9]*).txt") >>> >>> s = "a53bc_531.txt" >>> match = pattern.match(s) >>> if match: ... print int(match.group(1)) ... else: ... print "No match" ... 531 >>> Hope that helps, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

charting

2006-04-20 Thread Gary Wessle
Dear python users I am just wondering if python is the language to use to build a custom charting package which is live updated from live data stream coming through a socket. as well as dynamically execute data analysis code on the data being fed. I have been looking at SpecTix. thank you -- ht

Re: search files in a directory

2006-04-20 Thread Gary Herron
t. open can be used to open a file The open file has several methods to read bytes from the file: read() gets the whole file at once readline() return a line at a time other possibilities exist You can test to see if a string s is in another string t with if s in t: ... Hope that

debugging in emacs

2006-04-23 Thread Gary Wessle
Hi python users I am using emacs and python-mode.el under dabian testing. is there a way to debug python code where I can step over each line and watch the value of all the variables and be able to change any during debugging. say you have a loop structure and want to see what the values of your v

Re: debugging in emacs

2006-04-23 Thread Gary Wessle
Gary Wessle <[EMAIL PROTECTED]> writes: > Hi python users > > I am using emacs and python-mode.el under dabian testing. > is there a way to debug python code where I can step over each line > and watch the value of all the variables and be able to change > any during d

Re: What am I doing wrong here

2006-04-24 Thread Gary Herron
nd ' + ComputerName + ' "' + Message + '"') where the +'s build the command string up from pieces. You might try invoking Python interactively and try typing some of these expressions by hand to see that happens: python >>> ComputerName = 'Fred' >>> Message = 'HI' >>> print 'net send ComputerName "Message"' net send ComputerName "Message" >>> print 'net send %s "%s"' % (ComputerName, Message) net send Fred "HI" >>> Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

help finding

2006-04-25 Thread Gary Wessle
Hi I am going through some tutorials, how do I find out about running a script from the python prompt? is there a online ref and how to access it? thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested Lists Assignment Problem

2006-04-26 Thread Gary Herron
don't), then you have to find a different way to create three separate objects. The copy module helps with this in some cases, but for your simple example, you just want to create the three inner objects by evaluating the expression [0]*3 three times. Here's several ways: a = [] for i in range(3): a.append([0]*3) or a = [ [0]*3 for i in range(3)] Clear? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

raw_input passing to fun

2006-04-27 Thread Gary Wessle
the output of this code below is not what one would expect, it outputs all kind of numbers and it never stops, I want to ask the user for a number and then print out the multiplication table up to that number. thanks import math

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