Re: Should non-security 2.7 bugs be fixed?

2015-07-18 Thread Gary Herron
On 07/18/2015 04:36 PM, Terry Reedy wrote: I would like more viewpoints from 2.7 users. I read that (incorrectly of course) and just had to ask: How do you intend to extract a viewpoint from that last 7/10 of a user? With apologies, Gary Herron -- Dr. Gary Herron Department of

Re: Why won't this run?

2015-11-16 Thread Gary Herron
) lines to print(...) (without the colon) and try again. If there is further trouble, ask another question, but please cut and paste the actual and *exact* results into the email. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: Is this sort of a constraint implementable in Python?

2014-06-10 Thread Gary Herron
han a Python question. (Or rather a question about some Python/Cplex interface.) Do you have access to any kind of a CPLEX forum or a Cplex-via-Python forum? I think that's much more likely to get you an answer. Luck, Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: how to check if a value is a floating point or not

2014-06-18 Thread Gary Herron
string ... Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3.44 float addition bug?

2014-06-20 Thread Gary Herron
lways been there. See https://docs.python.org/2/tutorial/floatingpoint.html for more details. Gary Herron fresh install of https://www.python.org/ftp/python/3.4.1/python-3.4.1.amd64.msi and a fresh install of https://www.python.org/ftp/python/2.7.7/python-2.7.7.amd64.msi to compare it to.

Re: python 3.44 float addition bug?

2014-06-20 Thread Gary Herron
On 06/20/2014 06:11 PM, FraserL wrote: Ok I've seen https://docs.python.org/2/tutorial/floatingpoint.html now thanks to Yhg1s on #python I bet you get this kind of thing a lot, sorry :-/ Yes, often, but it's not a problem. :-) FraserL wrote in news:XnsA35313E634BA0fraserlonggmailcom34@21

Re: Multiprocessing question

2014-07-13 Thread Gary Herron
. So you have to ask yourself: What do you gain from using Python if you eliminate all the tools Python provides? Gary Herron - Paul S. LaFollette, Jr CIS Department Temple University +1 215 204 6822 paul.lafolle...@temple.edu <mailto:paul.lafolle...@tem

Re: ISO8583

2014-07-15 Thread Gary Herron
583 module. Do you know how to contact the developers of the ISO8583 package? Gary Herron If I send it incorrect parameter, the server will reply but if I send it correctly, the server didn't response. The original client is in java using ISOMUX, I have been trying to use the pyMux

Re: Distributing python applications as a zip file

2014-07-22 Thread Gary Herron
n!!! It's not quite self-contained, as you still need to have Python installed, but otherwise it's a good way to distribute a Python application as a single file that users can just copy and run. Really! 20 years of Pythoning, and I'd never seen this! When was this introduced?

Re: What meaning of this ""hello %s you are %s years old" % x"

2014-07-27 Thread Gary Herron
ou are just learning Python, you should probably use the *newer* formatting operations. See https://docs.python.org/3.3/library/string.html#formatspec for details of that. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: reading text files with indentation

2014-07-28 Thread Gary Herron
for line in lines: line = re.sub("#.*", "", line) line = line.strip() The *strip* method on strings removes all whitespace from both ends. There goes your indentation. policy_lines.append(line) print line Cheers Example: >&g

Re: Challenge to convert a simple IDL code into Python

2014-08-24 Thread Gary Herron
e. Please cut and paste. Second, saying it doesn't work us useless. Please tell us what the code is supposed to do, and what it actually does, what you expected... If there is output, cut and paste it. If there is an error traceback, cut and paste it. While you are at it, tell u

Re: Convert 3d NumPy array into 2d

2014-08-27 Thread Gary Herron
1440) >>> a.shape = (480,1440) >>> a.shape (480, 1440) Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: face detection

2014-09-22 Thread Gary Herron
programming language). I'm not sure where you would find information about face detection, but I'm sure you could find a better forum with a little searching. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.

Re: how to parse standard algebraic notation

2014-09-30 Thread Gary Herron
ed: x**2 ? or perhaps x^2 ? or something else like some Unicode characters or HTML to get a small superscript 2 above an x. Once you give an example of what your input looks like, we can start hashing out how to read it. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiP

Re: How to select every other line from a text file?

2014-10-13 Thread Gary Herron
you know how to test for evenness? (Use count%2 will be zero for even count values.) * Do you know how to write lines to an output file? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a counter

2014-10-15 Thread Gary Herron
unter, '\r', # The ending comma means do NOT output the usual \n Python3: print(counter, end='\r') Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I automate the removal of all non-ascii characters from my code?

2011-09-12 Thread Gary Herron
On 09/12/2011 12:49 AM, Alec Taylor wrote: Good evening, I have converted ODT to HTML using LibreOffice Writer, because I want to convert from HTML to Creole using python-creole. Unfortunately I get this error: "File "Convert to Creole.py", line 17 SyntaxError: Non-ASCII character '\xe2' in file

Re: how to make a nested list

2011-09-15 Thread Gary Herron
st an internal loop for filling an array) is probably more efficient, certainly less code, and arguably more Pythonic. A = [ [None,None] for i in range(1000) ] Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: help regarding extracting a smaller list from larger one

2011-09-15 Thread Gary Herron
t; a[3:6] array([3, 4, 5]) If you mean something else, please be more specific, and we'll try again. Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: help regarding extracting a smaller list from larger one

2011-09-15 Thread Gary Herron
w list to be a numpy array then numpy.array([ x for x in A if 3.0 <= x <= 8.0 ]) On Thu, Sep 15, 2011 at 10:54 PM, Gary Herron <mailto:gher...@digipen.edu>> wrote: On 09/15/2011 09:40 AM, neeru K wrote: Dear Python Users, I am trying to write a code for visu

Re: way to calculate 2**1000 without expanding it?

2011-09-16 Thread Gary Herron
: sum(map(int,str(2**1000))) 1366 Here's another one-liner using a generator instead of map: sum(int(c) for c in str(2**1000)) Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiplication error in python

2011-09-27 Thread Gary Herron
e incorrect result -- then we have a real bug. However, the chance of that is really really tiny. Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: getattr and method name

2011-10-02 Thread Gary Herron
essentially ignored. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for browser emulator

2011-10-13 Thread Gary Herron
On 10/13/2011 07:19 PM, Roy Smith wrote: I've got to write some tests in python which simulate getting a page of HTML from an http server, finding a link, clicking on it, and then examining the HTML on the next page to make sure it has certain features. I can use urllib to do the basic fetching,

Re: What is wrong with my code?

2011-10-23 Thread Gary Herron
; Strings aren't mutable in Python; you can't assign to slices of them. So you'll get a TypeError on the previous line. Cheers, Chris Also, the statement for i in nome: does not loop through indices, but rather it loops through the actual characters of the string. Gary H

Re: Binary tree implementation

2013-02-14 Thread Gary Herron
help, please put more time into the quality of your question.As it is stated, we really don't know what you want help with. Gary Herron PS: Sorry for previous mail !! Thank you :) -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-441

Re: python math problem

2013-02-15 Thread Gary Herron
1.53075794228e-15 is the (scientific notation) representation of .00153075794228. Is that not close enough to zero for your purposes? (Or is it that you don't understand the 'e-15' portion of the output?) -- Dr. Gary Herron Department of Computer Science DigiPen Institut

Re: request for help

2013-02-18 Thread Gary Herron
On 02/18/2013 11:42 AM, leonardo selmi wrote: pls i need help: i have copied the following from a book and tried to make it work: import math def area(radius): return math.pi * radius**2 def circumference(radius): return 2 * math.pi * radius i saved the above program from python shell into a

Re: request for help

2013-02-18 Thread Gary Herron
On 02/18/2013 12:14 PM, leonardo wrote: thanks guys and sorry for my incomplete datas, here is the error message: Traceback (most recent call last): File "", line 1, in import circle File "circle.py", line 1 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) ^ Sy

Re: How can i create a random array of floats from 0 to 5 in python

2013-03-12 Thread Gary Herron
973095679, 3.113889114931214, 3.05408169326, 2.360224809741029, 2.026697918525358, 1.322913986495805, 4.341848866805052, 0.970311202088483, 2.002058149505537, 0.07453277198439523, 1.9633241018322773, 4.22967258746455] -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology

Re: [Python 2.7.3] What's the difference between these two uses of "for"?

2013-03-17 Thread Gary Herron
collection immediately after the loop finishes. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieving data from a plot in python.

2013-04-09 Thread Gary Herron
line connecting (0,4) and (7,3) and so on. Are you asking a MATH question, or a Python question. This is, do you need the (linear) equation which performs the evaluation, or help in producing a program to do the calculation? Gary Herron -- Dr. Gary Herron Department of Computer Science

Re: Running simultaneuos "FOR" loops

2013-04-23 Thread Gary Herron
loops? for p in sorted(segments.iterkeys()): for k in sorted(class_count.iterkeys()): for j in sorted(pixel_count.iterkeys()): # This will be run with all possible combinations of p,k, and t. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Refresh the Desktop window with python script

2005-12-12 Thread Gary Herron
et the information of a machine like "computer name", >"mac address", "ip address" and "OS on that system". > > The platform module can give lots of such info: http://docs.python.org/lib/module-platform.html Good Luck, Gary Herron >Thanks

Re: IsString

2005-12-13 Thread Gary Herron
... whatever ... Several types would qualify as "numbers": IntType, FloatType, LongType, and ComplexType, and several as "strings": StringType and UnicodeType Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido at Google

2005-12-22 Thread Gary Herron
gt;- > >I have around one year to await. > > You don't appear to understand Open Source very well. Python is the way it is because we, the community, *like* it that way. It evolves in directions that we (all) decide it is to evolve. Guido is our leader in this because we trust him and *choose* to follow his lead. If you want something changed you don't wait and you don't whine, you join the community with a reasoned argument for why your idea would make it a better language in *our* eyes. So how about it... What's your complaint, what's your solution, and why should we listen? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentation/whitespace

2005-12-23 Thread Gary Herron
them somewhat more visible.) Try this experiment: Print out a page of C++ code, tape it to the wall, and start walking backwards. You will still be able to discern the structure of the code *long* after you can no longer identify the curly-braces. (Provided you properly indented you C++ code --

Re: Indentation/whitespace

2005-12-23 Thread Gary Herron
me, it makes >sense, just like Python makes sense. Any time-line on implementing this? > > Look at the date. That was an April Fools joke. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: reading files into dicts

2005-12-29 Thread Gary Herron
ple as that is, I'd still recommend the cPickle module. As always, this security warning applys: Evaluating arbitrary text allows anyone, who can change that text, to take over complete control of your program. So be carefully. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Global Variables in OOP and Python

2005-12-30 Thread Gary Herron
erever Parameters is imported: Parameters.xyzzy = 'whatever' Parameters.startDirectory = os.getcwd() # Get working directory at startup (Even if the import of Parameters in some file occurs before the initialization code has a chance to run.) Gary Herron >in all of the files (namespaces) where it i

Re: important for me!!

2006-01-02 Thread Gary Herron
nd good luck with your studies. Gary Herron >thanks... >Aysun > > > > -- http://mail.python.org/mailman/listinfo/python-list

Re: testing array of logicals

2006-07-12 Thread Gary Herron
thing for any function you wish to apply across the list.So then its only a matter of giving it a function that "and"s two arguments: Either: reduce(lambda a,b: a and b, logFlags) or def and2(a,b): return a and b reduce(and2, logFlags) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: run a string as code?

2006-07-17 Thread Gary Herron
aw_records.pos_records" > r_table = eval(tmp) > > works great thanks for the help! > Yes, it works, but this is not a good place to use eval. Now that we see how you want to use it, we can find a *much* better way to do it. If you want to lookup an attribute of an object, but the attribute name is a string in a variable, then use getattr to do the lookup. If in interpret your code correctly: attrname = state + "_raw_records" obj = getattr(h5file.root, attrname) r_table = obj.pos_records These, of course, could be combined into a single (but not necessarily clearer) line. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: list comprehension syntax..?

2006-08-01 Thread Gary Herron
tly unmaintainable, and not noticeably more efficient than code that is readable and maintainable. Moreover, all the work of creating the outer list seems to be wasted since that list is just thrown out. This is worse than "overly clever". Loops are for looping, list comprehensi

Re: can this b done

2006-08-03 Thread Gary Herron
lso be in the dictionary -- I have no idea how you plan to specify *which* local variable you want the name of. Anyway, the dictionary is: self.__dict__ and the list of variable names is the dictionary's keys: self.__dict__.keys() and one of the elements in that list will be the string: 

Re: import help

2006-08-07 Thread Gary Herron
named imp. It allows you to import a file whose name is specified in a string -- that should work for you. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Class data being zapped by method

2006-08-08 Thread Gary Herron
18)] >>> print bar.data [(-74.0014993, 1), (123.450999, 18)] >>> bar.a_count() [(-74.0014993, 1), (123.450999, 18)] >>> You effort to reduce your real code to a simple demonstration of the problem is appreciated, but I don't think it worked in this case. Want to try again? Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: self=pickle.load(file)? (Object loads itself)

2006-08-12 Thread Gary Herron
= A() # create an instance >>> a.__dict__ # It has no attributes {} >>> a.__dict__ = {'c':1, 'b':2} # Give it some >>> a.b # Verify 2 >>> a.c 1 >>> a.__class__ # Examine its class >>> class B: ... pass ... >

Re: Recurse Directories and process files in directory

2006-08-12 Thread Gary Herron
tem executes any command given as a string (which you can build however you want). Or you might use the newer "subprocess" module. Gary Herron > TIA. > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Loading module via full path

2006-08-21 Thread Gary Herron
Andre Poenitz wrote: > Hi all. > > Is there a way to load a module given a full path to the module > without extending sys.path first? > > Andre' > > The standard module named "imp" can help you with this. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: printing variables

2006-10-05 Thread Gary Herron
ar4': '', 'var1': 'blah', 'var3': 'blahblahblah', 'var2': 'blahblah', '__builtins__': , '__file__': '/home/gherron/.startup.py', '__name__': '__main__', '__doc__': None} >>> for v,k in locals().items(): ... if v.startswith('var'): ... print k ... blah blahblahblah blahblah >>> Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie - Stuck

2006-10-09 Thread Gary Herron
sent a string and reinterpret those bits as an integer, then ... perhaps you'd like to check out the struct module. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - leading zeros

2006-10-13 Thread Gary Herron
or that print. For example, here are several ways to convert an int to a printable string with and without leading zeros: >>> i = 123 >>> '%d' % i '123' >>> '%5d' % i ' 123' >>> '%05d' % i '00123' Hope that helps, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with the 'math' module in 2.5?

2006-10-14 Thread Gary Herron
ion of finite digit arithmetic. Python makes the opposite assumption that we are are adults here and can handle the full knowledge, slight imprecision and all. Dr. Gary Herron > Python refuses to guess what you want, and gives you the information > available. > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries

2006-10-18 Thread Gary Herron
dictionary in place rather than returning a new dictionary. >>> a={'a':1} >>> b={'b':2} >>> a.update(b) >>> a {'a': 1, 'b': 2} Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Dictionaries

2006-10-18 Thread Gary Herron
ou tried coding a solution and failed, or are you just expecting > people to code for free? > > > > Right. This thread begins to look like someone with a homework assignment asking for code rather than attempting to try programming it up himself. I was happy to answer th

Re: create global variables?

2006-10-30 Thread Gary Herron
. global g ... g = 123 ... >>> x() >>> g 123 >>> Gary Herron > ive tried simply adding the variables in: > > def function(atom, Xaa, Xab): > Xaa = onefunction(atom) > Xab = anotherfunction(atom) > > if i can give something

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Gary Herron
一首诗 wrote: > Is there any simple way to solve this problem? > > Yes, strings have a replace method: >>> s = "abc def" >>> s.replace(' ',' ') 'abc def' Also various modules that are meant to deal with web and xml and s

Re: ANN: SE 2.3. Available now

2006-11-03 Thread Gary Herron
Frederic Rentsch wrote: > A few Cheese Shop upload problems have been solved with the help of this > creative group. Thank you all! > > Version 2.2 beta should be phased out. It has a functional defect, > missing matches with a very low statistical probability. Version 2.3 has > this fixed. > >

Re: Strange behavior with iterables - is this a bug?

2006-05-30 Thread Gary Herron
and # Also works because files are reopened for each use: print [(i1.strip(),i2.strip(),i3.strip()) for i1 in open('word1.txt') for i2 in open('word2.txt') for i3 in open('word3.txt')] Hope that's clear! Gary Herron &

Re: Strange behavior with iterables - is this a bug?

2006-05-31 Thread Gary Herron
[EMAIL PROTECTED] wrote: >Gary Herron wrote: > > >>List comprehension is a great shortcut, but when the shortcut starts >>causing trouble, better to go with the old ways. You need to reopen each >>file each time you want to iterate through it. You should be able to

Re: A more elegant way to do this list comprehension?

2006-06-06 Thread Gary Herron
] > [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, > 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8] > > Thanks, > Levi Sure. Try: [i+1 for i in range(8) for j in range(i+1)] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: math.pow(x,y)

2006-06-11 Thread Gary Herron
culate an answer today (or even this week). I doubt that you really *want* all 3.4 million digits. So what is it you really want? A scientific or engineering result as a floating point number accurate to some reasonable number of digits? That integer value modulo some other integer (as used in v

Re: "groupby" is brilliant!

2006-06-13 Thread Gary Herron
ws* its length at all times. len() is a constant time lookup of an internal attribute. Gary Herron > The best I could come up with is sum(itertools.imap(lambda x: 1, g)) -- > but that does look a bit ugly ... > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Numerics, NaNs, IEEE 754 and C99

2006-06-14 Thread Gary Herron
ithmetic between infinities and real values. The production of, and arithmetic on, infinities is a choice that any application may want allow or not. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Legitimate use of the "is" comparison operator?

2006-06-17 Thread Gary Herron
ue >>> 100 is 100 True This is highly implementation dependent. The current (C) implementation of Python has a cache for small integers, so the attempt to compare values with "is" works for some small integers, and fails for some large integers, but curiously, not all insta

Re: MSoffice metadata

2006-06-24 Thread Gary Herron
the Python-UNO bridge). This might (eventually) get you what you want. Here's a URL for it: http://udk.openoffice.org/python/python-bridge.html Good luck, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: array manipulation without for loops

2006-06-25 Thread Gary Herron
But what's the point? This does the same as a for loop but slower. If you don't want any kind of a loop (again, What's the point?) you could write something recursive: def proc(i, ...): # ... do something with i if i < whatever: proc(i+1, ...) But this wo

Re: array manipulation without for loops

2006-06-25 Thread Gary Herron
s a number of very general operations that can be performed across arrays. Good luck Gary Herron > > /Sheldon > > Gary Herron wrote: > > >> Sheldon wrote: >> >>> Hi, >>> >>> I have two arrays that are of the same dimension but havin

Re: Beginner question: use function to read text file

2006-06-26 Thread Gary Herron
any uses of the name from enclosing scopes.) If that last makes sense, good. If not, then just follow this rule: Choose your variable names to be different than any builtin names -- or at least different than any of the builtin names you intend to use. Gary Herron > high=[] > lo

Re: Select in Python

2006-06-26 Thread Gary Herron
waiting to be read, and select always inform you of that fact by returning stdin in the rr list. If you want select to start blocking again, you must read all bytes from stdin whenever select says there are bytes to be read. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: missing feature classes and missing fields

2006-07-01 Thread Gary Herron
;missing fields"? What's a "shape file"? On what object to you wish to check "attribute values"? I'm not sure I can help even if I have those answers, but I'm sure I can't help if I don't. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: genetic algorithms package for python ?

2006-08-31 Thread Gary Herron
Lisp and another in Python. I know *nothing* about either one. http://packages.debian.org/unstable/devel/cl-rsm-genetic-alg.html http://home.gna.org/oomadness/en/genetic/ Enjoy, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: include statement

2006-09-19 Thread Gary Herron
imitive functionality back with the dinosaurs (C and its relatives) when we moved into the world of tje modern sophisticated programming language Python. Tell us why you are contemplating such a thing, and someone here will help you implement it the "Pythonic" way. Gary Herro

Re: Python/UNO/OpenOffice?

2006-09-29 Thread Gary Herron
> > Thanks, > Ken > I don't believe that information is out-of-date. I use the python-bridge with the OpenOffice version 2.0.3 quite successfully. In my case I open a spread sheet and search around for and extract various values. It works just fine for me. Gary Herron -- http:

Re: strange append

2006-10-01 Thread Gary Herron
ever create a copy of the object. If you *do* want to create an object, you may consider using the copy module: http://docs.python.org/lib/module-copy.html (But I must point out, that in 12 years of programming Python, I've hardly ever used that module.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

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

2006-12-03 Thread Gary Herron
someone into changing it, but if we've gone this long without caring to fix it, then I'd 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 compla

Re: terminology question - "foreign function library"

2006-12-24 Thread Gary Herron
that function with your parameters. This is done directly in Python and ctypes without 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
refer to it. Here's some working code which manipulates a reference to a function then calls it: >>> def fn(): ... print "Hello world!" ... >>> 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 do I dynamically create functions without lambda?

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

Re: Module imports

2006-01-30 Thread Gary Herron
ions they need. > That's not true. Have you actually tried this? It works perfectly, and is, in fact, the expected and standard operation procedure.The functions from myFunctions execute in the environment of the module they were define in, no matter how you import/reference them

Re: python printout format

2006-02-01 Thread Gary Herron
: >python -c "import compileall; compileall.compile_dir('.',0)" >Listing . ... >Compiling ./Ciscoports.py ... > File "./Ciscoports.py", line 753 >print string.ljust(PortlinkbeatInv[row[j][0]],14), >^ >SyntaxError: invalid syntax >

Re: Newbie

2006-02-12 Thread Gary Herron
LittlePython wrote: >Is this a good place to post python questions from newbie's, or would you >suggest another board? >Thx > > This is the correct place. This group has the reputation of being newbie-friendly. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Module question

2006-02-21 Thread Gary Herron
se 1, no matter how many times an import causes phase two to be performed. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: forcing exceptions

2006-03-03 Thread Gary Herron
ck try: assert False except: traceback.print_exc() and you'll get a traceback (a very short one in this case): Traceback (most recent call last): File "", line 2, in ? AssertionError Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: forcing exceptions

2006-03-03 Thread Gary Herron
A traceback.print_exc() within the "except" clause will print it at that point, then execution can continue normally. Gary Herron > > >- Bill > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Going crazy...

2005-06-13 Thread Gary Herron
;t >work, so it must be some other syntax. > > Not with tuples, lists or dictionaries. However a more recent addition to the language is Sets, and they support set differences: >>> from sets import Set >>> Set([1,2,3,4,5,6]) - Set([2,3,6]) Set([1, 4, 5]) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: subexpressions (OT: math)

2007-06-03 Thread Gary Herron
hat doesn't invalidate the claim that the value *is* a dimensioned quantity. In lieu of a name, we'd have to label such a quantity as "sqrt of degrees" or "sqrt of radians". After all, we do the same thing for measures of area. We have some units of area like &

Re: subexpressions (OT: math)

2007-06-03 Thread Gary Herron
Wildemar Wildenburger wrote: > Gary Herron wrote: > >> Of course not! Angles have units, commonly either degrees or radians. >> >> However, sines and cosines, being ratios of two lengths, are unit-less. >> >> >>> To understand it: sin()

Re: How does os.walk work?

2007-06-07 Thread Gary Herron
directories. After giving you a chance to modify that list, ow.walk then goes through the list (whatever contents it has at that point) and visits any subdirectory. I'd guess your trouble with understanding this has to do with wondering how the modified list gets from your code back to os.wa

Re: urllib2 - iteration over non-sequence

2007-06-09 Thread Gary Herron
you can iterate through that list of lines. Like this: import urllib2 url = urllib2.urlopen('http://www.google.com') for line in url.readlines(): print line url.close() Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2 - iteration over non-sequence

2007-06-09 Thread Gary Herron
with sizes that are putting a serious strain on your memory footprint, then one of the other suggestions might be indicated. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Probably simple syntax error

2007-07-01 Thread Gary Herron
laces > **weights_array(randomizing_counter) = small_randomized_int > If weights_array is a list or dictionary then use weights_array[randomizing_counter] = ... to choose which element of the list gets the assignment. If weights_array is a function, then weights_array(rand

Re: import

2007-07-06 Thread Gary Herron
jolly wrote: > Hey guys, > > I'm rather new to python and i'm have trouble(as usual) > > I want to know if it is possible to change where 'import' looks > this will save me clogging up my python directory > > Thanks > Easily done. The value of sys.path is a list of directories that import

Re: really small values

2007-07-17 Thread Gary Herron
. However, there are software packages that represent numbers (integer and floating point) with larger collections of bit. Try looking at GMP at for one such package: http://gmplib.org/ Good luck, Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-18 Thread Gary Herron
s than 0 (and probably less than any integer). Given that, your two observations above are consistent. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: comparison with None

2007-04-18 Thread Gary Herron
if type( x ) == NoneType: >> # true >> < code > >> else: >> # false; do something else. >> < more code > >> >> Steven Howe >> > > Is that any better than this? > > if x is None: > # do something > else

Re: Is it possible to determine what a function needs for parameters -

2007-05-02 Thread Gary Herron
ere? > > Obviously? Conditions? What conditions? We do things like this constantly, and in fact, it *does* work. Please tell us how it fails, or what is unsatisfactory about it. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: N00b question on Py modules

2007-05-07 Thread Gary Herron
local* to that function. And like all local variables, they can be set and used within the function, but are independent of objects outside the function. If you want to assign to a global object from within a function, then you must explicitly say so: def setExitCode(): global _exitco

<    1   2   3   4   5   6   7   8   >