Re: Cannot figure out line of code, also not understanding error

2014-02-20 Thread Gary Herron
it is created is your choice. Assignment is one possibility, but many other operation are also possible: x = Athlete(...) print( Athlete(...) ) Athlete(...)+Athlete(...) # If addition made any sense and was implemented in the class return Athlete(...) ... Gary Herron -- https

Re: sorting 1172026 entries

2012-05-06 Thread Gary Herron
do the in-place sort: temp.sort() Same result, less thrashing. This will make your program slightly more efficient, HOWEVER, it is not the solution of your week-long sort problem. Gary Herron On Sun, May 6, 2012 at 6:26 PM, J. Mwebaze jmweb...@gmail.com mailto:jmweb...@gmail.com

Re: What’s the differences between these two pieces of code ?

2012-07-06 Thread Gary Herron
to be comparing? Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2011-04-01 Thread Gary Herron
On 04/01/2011 12:52 PM, Karl wrote: Hello, one beginner question: aList = [0, 1, 2, 3, 4] bList = [2*i for i in aList] sum = 0 for j in bList: sum = sum + bList[j] Your j is already an element of bList. You don't need to index bList again. Instead do for b in bList:

Re: Fibonacci series recursion error

2011-04-29 Thread Gary Herron
in comparison [36355 refs] can any one help You correctly test for n==1, but what about when n==2?When the recursion works its way down to fib(2), you call both fib(1) and fib(0), but the latter starts an infinite sequence of calls to fib(-1), fib(-2) and so on without end. Gary Herron -- http

Re: Remove comma from tuples in python.

2014-02-21 Thread Gary Herron
. It has no commas or parentheses. The *printing* of a Python tuple uses both for it's appearance on the output, but the tuple itself has no such thing. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-21 Thread Gary Herron
v = 456 # Assigns to the global v. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange behavior with sort()

2014-02-26 Thread Gary Herron
On 02/26/2014 10:24 PM, ast wrote: Hello box is a list of 3 integer items If I write: box.sort() if box == [1, 2, 3]: the program works as expected. But if I write: if box.sort() == [1, 2, 3]: Most such questions can be answered by printing out the values in question and

Re: image processing in python and opencv

2014-03-09 Thread Gary Herron
three seem to be implied above.) Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Making Labels from python

2014-03-09 Thread Gary Herron
for you. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: running python 2 vs 3

2014-03-20 Thread Gary Herron
it really does look like any other installed program. If you need to be in a specific directory when you run it, then perhaps you should consider a bit of a rewrite to remove this constraint. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Memory error

2014-03-24 Thread Gary Herron
'] This is not really a Python question. It's a question about netCDF (whatever that may be), or perhaps it's interface to Python python-netCD4. You may get an answer here, but you are far more likely to get one quickly and accurately from a forum dedicated to netCDF, or python-netCD. Good luck. Gary

Re: writing reading from a csv or txt file

2014-03-30 Thread Gary Herron
. or book, textbook. How is this a Python question? There is a standard module included with Python for reading CSV files. Would you like to know how to use that? You can find documentation on it here: http://docs.python.org/3/library/csv.html Gary Herron -- https://mail.python.org/mailman

Re: If statement issue driving me nuts

2014-04-06 Thread Gary Herron
it to work? What did you get instead? If there was a traceback, please include it in an email. While you're at it, please also tell us what version of Python, and on what hardware you are running -- just in case that matters. Gary Herron -- https://mail.python.org/mailman/listinfo/python

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Gary Herron
, and (as always) without regard to the specifics or contents of those two objects. Gary Herron Python 3.3.2+ (default, Feb 28 2014, 00:52:16) [GCC 4.8.1] on linux Type help, copyright, credits or license for more information. a = [1,2,3] b = [4,5,6] c = (a,b) c ([1, 2, 3], [4, 5, 6]) c[0][0] = 0

Re: the logical operation confused me

2014-04-10 Thread Gary Herron
) True bool(ok) True perhaps you meant not ok False Once past that possible confusion, the return value of the *and* and *or* operators are explained here: https://docs.python.org/release/2.5.2/lib/boolean.html Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Pass variable by reference

2014-05-05 Thread Gary Herron
something very different, And your question then goes on to end on an even more confused note with I want to nuke ... which seems to have nothing to do with passing values anywhere? Sorry to be of so little help, Gary Herron For example, here's the issue I am running in to: I am trying

Re: How can this assert() ever trigger?

2014-05-10 Thread Gary Herron
this clearly, try this Python code: a = 1.0 while a 0: ... a = a*1.0e-50 ... print(a) ... 1e-50 1e-100 1e-150 1e-200 1e-250 1e-300 0.0 Gary Herron Any hints appreciated. Groetjes Albert -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP 8 : Maximum line Length :

2014-05-14 Thread Gary Herron
?! Sheesh! A relic of the days when terminals were ASCII and 80x24 Which is a relic of the even older punch cards which contained one line of (up to) 80 characters. Gary Herron 80 character was the hard limit. The soft limit for readability is 60..65 characters. Think about it. Just

Re: IndexError: pop from empty list

2014-05-15 Thread Gary Herron
| sample_bytes.pop(0)) IndexError: pop from empty list The error means that sample_bytes is an empty list so calling pop is an error. Or were you asking something deeper, like *why* sample_bytes is an empty list? Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't figure out 'instance has no attribute' error

2014-05-17 Thread Gary Herron
and addEdge should all be at the same indentation level. Instead, you have the later two defined *inside* the __init__. Gary Herron File RW1: class PHY_NETWORK: def __init__(self, nodes, edges): self.nodes = nodes self.edges = edges def addNode(self, node

Re: Python and Math

2014-05-17 Thread Gary Herron
mentioned, I'll add Sage: www.sagemath.org/index.html which presents a consistent Python interface to nearly 100 OpenSource mathematical packages containing symbolic manipulation of all sorts of algebra, calculus, linear algebra, plotting, rings and groups, and much *much* more. Gary Herron

Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Gary Herron
does. Why you think it's wrong. You should also tell us what version of Python you are using, and on what platform you are running it. Moreover, please reduce down to a bare minimum, the amount of code needed to show us the part that fails. Gary Herron -- https://mail.python.org/mailman

Re: Yet another simple headscratcher

2014-05-30 Thread Gary Herron
example that demonstrates problem: row = [0,0,0,0] data = [] data.append(row) data.append(row) data[0][0] = 99 data [[99, 0, 0, 0], [99, 0, 0, 0]] Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Segmentation fault (core dumped) while using Cplex Python API

2014-06-01 Thread Gary Herron
in CPLEX not in Python, and I've never seen CPLEX mention mentioned in this Python newsgroup. None of which means you won't get an answer here, but I think a CPLEX specific forum would be a better bet. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: can someone explain the concept of strings (or whatever) being immutable

2014-06-02 Thread Gary Herron
. my question is what happens to the original string?? Is it still in memory somewhere, nameless? Thanks in advance, Yes, possibly, for a short while it will be nameless in memory somewhere. If nothing else is pointing to it, it will eventually be garbage collected. Gary Herron

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

2014-06-10 Thread Gary Herron
. (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-19 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
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. #test

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 fraser.long+use...@nospamgmail.com wrote in

Re: Using an object inside a class

2012-01-23 Thread 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: what is this kind of string: b'string' ?

2010-09-01 Thread Gary Herron
On 09/01/2010 02:32 PM, Stef Mientki wrote: in winpdb I see strings like this: a = b'string' a 'string' type(a) type 'str' what's the b doing in front of the string ? thanks, Stef Mientki In Python2 the b is meaningless (but allowed for compatibility

Re: compare dictionaries

2010-09-07 Thread Gary Herron
not in dict2: return False #if any character is not in dict return True # otherwise If you know of generator expressions, and remember that True and False are 1 and 0 respectively, then this works def ...(): return sum(c in dict2 for c in word) == len(word) Gary Herron -- Gary

Re: compare dictionaries

2010-09-07 Thread Gary Herron
respectively, then this works def ...(): return sum(c in dict2 for c in word) == len(word) Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 ok but how do we address the fact that letter e needs to have the value 2 in the dictionary

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Gary Herron
.) List comprehension may also be faster, but you'd have to test to know for sure. x=[2,4,3,1] y=[5,9,10,6] z = [a*b for a,b in zip(x,y)] print z [10, 36, 30, 6] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: toy list processing problem: collect similar terms

2010-09-25 Thread Gary Herron
(r.values())) produces: (['a', 'b'], ['c', 'd', 'i', 'j'], ['e', 'f', 'k', 'l', 'o', 'p'], ['g', 'h'], ['m', 'n', 'q', 'r'], ['s', 't']) -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: partial sums problem

2010-09-28 Thread Gary Herron
an expression. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine sockets in use by python

2010-09-29 Thread Gary Herron
anyone have any suggestions on how to proceed? Thanks in advance It's certain that any answer to this will depend on which operating system you are using. So do tell: What OS? -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http

Re: Inheritance and name clashes

2010-10-03 Thread Gary Herron
won't willingly allow someone else to control what I have access to. And I assume that if I do step on something important, I'll figure it out during testing, long before releasing any code. Gary Herron Please give me a hand on this one :) Rock -- http://mail.python.org/mailman/listinfo

Re: 2D List

2010-10-11 Thread Gary Herron
(...) attempts to append something to an integer -- an operation that makes no sense. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes in a class: how to access variables from one in another

2010-10-18 Thread Gary Herron
. OuterOb.InnerOb.attribute Hope that answers your question. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating PDF file in Python

2010-10-26 Thread Gary Herron
applications, including a 'report language' so that users can customize their own reports. * As 'build system' for complex documents with charts, tables and text such as management accounts, statistical reports and scientific papers * from XML to PDF in one step Luck, Gary Herron -- http

Re: is list comprehension necessary?

2010-10-26 Thread Gary Herron
of there call. Example: i = 5 l = [i**2 for i in range(3)] i 2 That (very small) issue has been fixed in Python3: l = [i**2 for i in range(3)] i Traceback (most recent call last): File stdin, line 1, in module NameError: name 'i' is not defined Gary Herron I must admit you make a good point

Re: playful coding problems for 10 year olds

2010-11-01 Thread Gary Herron
based on sensor values for object avoidance or light following and such. Great fun (and a bit of Python programming) was had by all. -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiprocessing question

2014-07-13 Thread Gary Herron
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...@temple.edu http

Re: ISO8583

2014-07-15 Thread Gary Herron
. 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.py

Re: Distributing python applications as a zip file

2014-07-22 Thread Gary Herron
, 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? Gary Herron -- https://mail.python.org/mailman

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

2014-07-27 Thread Gary Herron
, 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
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: abc .strip() 'abc' Gary Herron

Re: Challenge to convert a simple IDL code into Python

2014-08-24 Thread Gary Herron
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 us what the IDL code does and cut and paste it's output. Gary Herron

Re: Convert 3d NumPy array into 2d

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

Re: face detection

2014-09-22 Thread Gary Herron
(a 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.python.org

Re: how to parse standard algebraic notation

2014-09-30 Thread Gary Herron
? 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 DigiPen Institute

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

2014-10-13 Thread Gary Herron
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
means do NOT output the usual \n Python3: print(counter, end='\r') Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Combining lists to dictionary

2014-11-11 Thread Gary Herron
StopIteration. ... 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: Help with Python Multiprocessing

2014-11-13 Thread Gary Herron
in a directory named Worker1 (and the same for directories Worker2 and Worker3). I think it's more likely that you miss-typed the above code. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Error when trying to open an image

2014-11-16 Thread Gary Herron
, but (if you look at the error message) its with importing PIL. Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Brython 3.0.0 relased

2014-11-16 Thread Gary Herron
to leverage that knowledge and code for WebGL without getting any deeper into Javascript than necessary. I'm happy to report that Brython worked perfectly, seamlessly providing Python calls to (the JavaScript API) WebGL. Amazingly well done! Gary Herron -- Dr. Gary Herron Department of Computer

Re: Using Python for date calculations

2014-11-21 Thread Gary Herron
. See https://docs.python.org/2/library/datetime.html Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-16 Thread Gary Herron
# to get your stuff but named math. Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Can someone help please

2011-07-21 Thread Gary Herron
it, but this time include more information: The files in '.', their content, the output you do get, and the output you expected. 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: Can someone help please

2011-07-21 Thread Gary Herron
even tried to run this.) The call f.readlines() returns a list which causes an error when added to a string: TypeError: cannot concatenate 'str' and 'list' objects Gary Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http

Re: how to separate a list into two lists?

2011-08-06 Thread Gary Herron
, any methods to make this done? List comprehension: L1 = [item[0] for item in L] L2 = [item[1] for item in L] which *is* still a loop. (You are going to have to write *really* arcane code to have no loop.) Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: pairwise combination of two lists

2011-08-17 Thread Gary Herron
() but it only gives [('a', '1'), ('b', '2')], not exactly what I am looking for. Thank you. - Yingjie li1 = ['a', 'b'] li2 = ['1', '2'] print [a+b for a in li1 for b in li2] ['a1', 'a2', 'b1', 'b2'] Gary Herron -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating point multiplication in python

2011-09-06 Thread Gary Herron
On 09/05/2011 10:57 PM, xyz wrote: hi all: As we know , 1.1 * 1.1 is 1.21 . But in python ,I got following : 1.1 * 1.1 1.2102 why python get wrong result? Who can tell me where's the 0.0002 from? It's not a python errorIt's the nature of floating point

Re: I am confused by

2011-09-07 Thread Gary Herron
Herron -- Gary Herron, PhD. Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://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
, 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
, 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
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 gher...@digipen.edu 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 visualization (raster plots

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

2011-09-16 Thread Gary Herron
a codegolf contest out of it. My entry: 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

Re: Multiplication error in python

2011-09-27 Thread Gary Herron
, 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
and 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

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 Herron -- http

Re: how to solve complex equation?

2013-01-01 Thread Gary Herron
is going to put that kind of time into answering your question here. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary tree implementation

2013-02-14 Thread Gary Herron
, 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-4418 -- http

Re: python math problem

2013-02-15 Thread Gary Herron
as 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 Institute of Technology

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

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 pyshell#0, line 1, in module import circle File circle.py, line 1 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)

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

2013-03-12 Thread Gary Herron
, 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 (425) 895-4418

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

2013-03-17 Thread Gary Herron
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: Append to python List

2013-05-09 Thread Gary Herron
On 05/08/2013 11:36 PM, RAHUL RAJ wrote: Checkout the following code: sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] output=[] output=[x for x in sample2 if x not in output] This statement is not doing what you expect. It is not building a list in the variable named

Re: create new python file

2013-06-04 Thread Gary Herron
. For instance: with open(Hello.py, w) as f: print(print('Hello world')\n, file=f) will create a file containing a simple one-line Python program. If you meant something else, then please take the time to provide more detail. Gary Herron -- Dr. Gary Herron Department of Computer Science

Re: Default Value

2013-06-19 Thread Gary Herron
(or rather with each call to the function that does not supply its own value for L). Gary Herron print(f(1)) print(f(2)) print(f(3)) This will print [1] [1, 2] [1, 2, 3] How the list is retained between successive calls? And why? -- Dr. Gary Herron Department of Computer Science DigiPen

Re: n00b question on spacing

2013-06-21 Thread Gary Herron
= fmt % (settings['MONGODB_DB'], settings['MONGODB_COLLECTION']) log.msg(msg, level=log.DEBUG, spider=spider) Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: analyzing time

2013-07-05 Thread Gary Herron
and analysis. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- http://mail.python.org/mailman/listinfo/python-list

Re: RAM slots problem

2013-07-09 Thread Gary Herron
On 07/08/2013 10:06 PM, saadharana wrote: I've got some annoying problem with RAM. I was depth cleaning my case, everything regular, it wasn't my first time. And when I put it all together and powered it on, it wasn't working, just beeps fast. But how that happend when I put all back in like it

Re: Storing a very large number

2013-07-17 Thread Gary Herron
) '2077446682327378559843444695582704973572786912705232236931705903179519704325276892191015329301807037794598378537132233994613616420526484930777273718077112370160566492728059713895917217042738578562985773221381211423961068296308572143393854703167926779929682604844469621152130457090778409728703018428147734622401526422774317612081074841839507864189781700150115308454681772032' str(12**345)[209] '1' Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen

Re: Creating a Program to Decompose a Number and Run a Function on that Decomposition

2013-07-18 Thread Gary Herron
miss-matched parentheses. ... n = n2 / m ... r = n2 - n * m ... rtn.append(m * x[n] + r * (x[n + 1] - x[n])) ... print 'n2 =', n2, ': n =', n, ' r =' , r, ' rtn =', rtn ... rtn However, I am getting the error expected an indented block on line two. Any idea why? -- Dr. Gary

Re: help with processing text file

2014-12-04 Thread Gary Herron
. I would use regular expressions. See https://docs.python.org/3/library/re.html Gary Herron -- https://mail.python.org/mailman/listinfo/python-list

Re: Question on lambdas

2014-12-08 Thread Gary Herron
value (from the outer scope). Any help would be greatly appreciated. TIA, Monte Hope that helps, 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: problems with Methods in Python 3.4.2

2014-12-18 Thread Gary Herron
no attribute '_doc_' What did I do wrong ? Thanks for help, Marcus Luetolf, M.D., 90 Bondastreet, CH-7000 Chur, Switzerland. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https://mail.python.org/mailman/listinfo/python-list

Re: surprise - byte in set

2015-01-03 Thread Gary Herron
this a problem, but a infinitely indexable object *is* a bit of an oddity. Patrick --- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. http://www.avast.com -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418 -- https

Re: Delegation in Python

2015-01-24 Thread Gary Herron
Fraction(2,1).is_integer() True 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: Delegation in Python

2015-01-24 Thread Gary Herron
is achieved by doing nothing! Brian That's *not* doing nothing. And it's not even really delegation. It's just sub-classing Fraction to add one new method and inherit all other methods. Gary Herron -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology

Re: MS-DOS Commands

2015-01-11 Thread Gary Herron
to experiment with Python. It came with your installation of Python. * In the future, questions should be accompanied with information about your version of Python (Python2 or Python3) and the platform you are running it on. (Apparently Windows in your case.) Gary Herron -- https

<    2   3   4   5   6   7   8   >