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
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
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
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:
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
. 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
v = 456 # Assigns to the global v.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
three seem to be implied above.)
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
for you.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
']
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
. 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
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
, 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
)
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
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
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
?!
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
| 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
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
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
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
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
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
.
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
. (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
string ...
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
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
.
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
.) 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
(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
an expression.
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
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
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
(...) 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
.
OuterOb.InnerOb.attribute
Hope that answers your question.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
.
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
, 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
, 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
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
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
)
a.shape
(480, 1440)
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
(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
? 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
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
means do NOT output the usual \n
Python3:
print(counter, end='\r')
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
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
, but (if
you look at the error message) its with importing PIL.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
.
See https://docs.python.org/2/library/datetime.html
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
# to get your stuff but named math.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
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
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
, 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
() 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
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
Herron
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
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
, 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
, 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
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
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
, 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
and essentially ignored.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
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
] =
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
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
, 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
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
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
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)
, 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
immediately after the loop finishes.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
. 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
(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
= 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
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
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
)
'2077446682327378559843444695582704973572786912705232236931705903179519704325276892191015329301807037794598378537132233994613616420526484930777273718077112370160566492728059713895917217042738578562985773221381211423961068296308572143393854703167926779929682604844469621152130457090778409728703018428147734622401526422774317612081074841839507864189781700150115308454681772032'
str(12**345)[209]
'1'
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen
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
.
I would use regular expressions. See
https://docs.python.org/3/library/re.html
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
601 - 700 of 776 matches
Mail list logo