?
Cheers,
-Xav
It's a joke -- see http://en.wikipedia.org/wiki/April_Fools%27_Day
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
will be used. Python, the C implementation, does both, choosing
the second option for small integers (those less 100 last time I checked).
Gary Herron
--
Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python
hsv_to_rgb from the
standard Python library to convert to RGB. Enjoy!
Gary Herron
from colorsys import hsv_to_rgb
for hue :
rgb = hsv_to_rgb(hue, saturation, value)
Let 'hue' run from 0 (red) through 2/3 (blue) Hues from 2/3 to 1 get
into purples and magentas, which are not spectral (i.e
: int(s.split('_')[1]))
(Which is not necessarily elegant, but it is short.)
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
*d)
If the denominator is zero then the lines are parallel, and there is no
(unique) solution.
(There are other was of solving the system, but they will all amount to
the same arithmetic, and will, of course, produce the same result.)
Gary Herron
are equivalent. The reason it fails is that, by the time it
gets around to the third delete, there is no longer in index [6] in the
list. The element you were thinking of is now at index [4].
This, however, will work as you expected:
del z[6], z[3],z[2]
--
Gary Herron, PhD.
Department
, but not in class blocks.
Note: The contents of this dictionary should not be modified;
changes may not affect the values of local and free variables used
by the interpreter.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
to do
Thanks
Do you know how to open a file, and how to read individual lines from it?
If so, then you can split a line at the spaces into a list by using
fields = line.split()
Then
print fields[0], fields[3]
would do what you ask.
Gary Herron
--
http://mail.python.org/mailman
Dodo wrote:
Help! this is driving me crazy lol
I want to print raw binary data to display an image file
BUT
python3 outputs b'binary data' instead of binary data so the
browser can't read the image!!
f = open(/some/path/%s % x, 'rb')
print(f.read())
any idea?
Dorian
Huh??? In
a decade or so before discovering Python in
the mid 90's, but I never forgot that paper nor lost my eager
anticipation waiting for language design to catch up with that idea.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
On 05/19/2010 02:53 PM, Back9 wrote:
Can anyone explain the difference between f and d in struct unpack?
When using them, some data work in either one not both.
To me it seems to be same,
TIA
'f' is single precision float (32 bits), and
'd' is a double precision float (64 bits)
Gary
on.Various methods of output may or may not
convert those characters back into \n and \t and so on. But that's a
matter of output not internal storage.
So tell us what you're trying to accomplish -- and better also tell us
Python2 or Python3?
Gary Herron
--
http://mail.python.org
]
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
to look. Show us how
you created that file.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
...
... mpmath.whatever ...
Gary Herron
Trash the search function fro the regular expression module?
I'm running Python 2.6.2 on Mac running OS 10.6.3.
Thanks!
Buff Miner
--
Enig Associates, Inc.
Suite 500, Bethesda Crescent Bldg.
4600 East West Hwy
Bethesda, Maryland 20814
Tel:(301)680
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility
...
Rohit
See either of these packages:
PyQt: http://qt.nokia.com/products/
PySide: http://www.pyside.org/
Either one should work with PyDev.
Gary Herron
--
http://mail.python.org/mailman
be written as the sum of two squares.
For example, 10 can only be written as 32 + 12 (we don't count 12 + 32
as being different). On the other hand, 25 can be written as 52 + 02
or as 42 + 32.
Huh? In what number system does 10 = 32 + 12?
And how do either 32 or 12 qualify as perfect squares?
Gary
in place.In your code,
you print a and print c, but you should have done print b, where
you will find the result you expect.
Gary Herron
==
Anand Jeyahar
http://sites.google.com/a/cbcs.ac.in/students/anand
Jeremy Banks wrote:
Hi. I'm sure there've been debates about this before, but I can't seem
to figure out what to search for to pull them up, so I'm asking here.
It seems to me that a lot of things could be made much easier if you
could use primaries other than basic identifiers for the target
Jeremy Banks wrote:
Thanks for your comments.
On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote:
[...]
There's no need for a specific addition to the syntax to do this.
Try this:
def foo_bar():
return(...)
foo.bar = foo_bar
the differences
-- they are minor and evolutionary not revolutionary.)
Gary Herron
My essential question is Is Python 2.6 similar enough to Python 3.0
to justify its complexity of installation? Upgrading to Jaunty is NOT
an option
(http://welcome2obscurity.blogspot.com/2009/05/jaunty-jackalope
on using generators for
building and linking together individual stream filters. Its very cool
and surprisingly eye-opening.
See Generator Tricks for Systems Programmers at
http://www.dabeaz.com/generators/
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Wells wrote:
Why can't I do this?
teams = { SEA: Seattle Mariners }
for team, name in teams.items():
teams[team][roster] = [player1, player2]
Because,
team will be SEA,
so
teams[team] will be Seattle Mariners
and
Seattle Mariners[roster] makes no sense.
Gary Herron
I
contents.
Now, what is it you were trying to do?
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
.
For instance A+B+C+D could be calculated sequentially as implied by
((A+B)+C)+D
or with some parallelism as implied by
(A+B)+(C+D)
That's an application of the associativity of addition.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
with
the OP's division of 4 by 5.0, but rather that the value of 0.8 itself
cannot be represented exactly in IEEE 754. Just try
print repr(0.8) # No division needed
'0.80004'
Gary Herron
I have the same feeling towards databases.
--
http://mail.python.org/mailman/listinfo/python
R. David Murray wrote:
Gary Herron gher...@islandtraining.com wrote:
MRAB wrote:
Grant Edwards wrote:
On 2009-05-21, Christian Heimes li...@cheimes.de wrote:
seanm...@gmail.com schrieb:
The explaination in my introductory Python book is not very
satisfying
guesswork.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
, and see if someone is
willing to make suggestions or answer specific question about your
attempt at a solution?
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Marius Retegan wrote:
Hi,
On Fri, May 29, 2009 at 2:09 AM, Gary Herron
gher...@islandtraining.com mailto:gher...@islandtraining.com wrote:
Marius Retegan wrote:
Hello
I have simple text file that I have to parse. It looks
something like
width, and then supply the actual width as a
separate parameter:
print '%*d' % (5,123)
123
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
so, perhaps this will answer your question
class Foo:
... pass
...
print Foo.__name__
Foo
c = Foo
print c.__name__
Foo
ob = Foo()
print ob.__class__.__name__
Foo
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
Gary Herron
-- bjorn
--
http://mail.python.org/mailman/listinfo/python-list
Zach Hobesh wrote:
Hi everybody,
Here's my situation:
I have a batch file that calls a python script.
This batch file is triggered by an outside application when the
application completes a task. The problem is that while the batch
file (and pythons script) is running, the application will
On 07/29/2013 01:56 PM, Devyn Collier Johnson wrote:
I tried Pyglet in a Python3 and a Python2 script, but both fail. The
error code is below and the script is attached. The 'boot.ogg' file is
Ubuntu's default bootup sound. I got my code from this link
you set it:
d[2] = 0 # for instance
You may want to look at defaultdict from the collections module.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
%20also%20a%20strongly%20typed%20language
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
). It's far, FAR,
easier than rolling your message, especially when attachments are needed.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
use is
until you understand this:
q:~ python3
Python 3.3.1 (default, Apr 17 2013, 22:32:14)
[GCC 4.7.3] on linux
Type help, copyright, credits or license for more information.
101 is 1+100
True
1001 is 1+1000
False
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
On 08/10/2013 03:09 PM, Chris Angelico wrote:
On Sat, Aug 10, 2013 at 10:48 PM, Gary Herron
gary.her...@islandtraining.com wrote:
This is an oversimplification, but generally useful for all beginner (and
most advanced) programmers:
Don't use is for comparisons. Use ==.
It 20 years
On 08/10/2013 08:09 PM, Krishnan Shankar wrote:
Thanks Tim,
This takes me to one more question.
'is' operator is used to compare objects and it should not be used to
compare data.
So can it be compared with 'False'.
i.e. Is this code possible
if a is False:
print 'Yes'
if b is False:
On 08/10/2013 06:00 PM, Chris Angelico wrote:
On Sun, Aug 11, 2013 at 1:42 AM, Gary Herron
gary.her...@islandtraining.com wrote:
On 08/10/2013 03:09 PM, Chris Angelico wrote:
_notpassed = object()
def frob(appendage, device=_notpassed):
Use some appendage to frob some device, or None
On 08/10/2013 08:43 PM, Chris Angelico wrote:
On Sun, Aug 11, 2013 at 4:21 AM, Gary Herron
gary.her...@islandtraining.com wrote:
On 08/10/2013 06:00 PM, Chris Angelico wrote:
Wrong. If you do equality comparisons, it's entirely possible for
something to be passed in that compares equal
to a reader of your program.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
of behavior.
However, *hiding* the members of a class is not considered Pythonic.
There is no private/public as in C++, however, there are way to achieve
that effect.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
On 08/23/2013 04:38 PM, jeangaw...@gmail.com wrote:
Python allows you set the value of True
True = 1.3
Now this is consistent with the decision to let you set the
value of various builtin names. But why is this case different:
None = 1.3
File stdin, line 1
SyntaxError: cannot assign to
come to like
Python's indentation eventually. Many (most?) of the rest of here have.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
* at all to do with objects and encapsulation.
Please don't confuse:
the binding of names to objects and
the existence of objects and their encapsulated behavior
They are very different things.
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
in response.
By calling it a _command_, you seem to expect some particular behavior
out of the receiving process. Please tell us *what* that might be, and
we'll see what we can do to help out.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425
were you trying to achieve?
Since you are asking volunteers to help, it would be polite to take the
time to explain things carefully.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
package might offer the remaining functionality easily.
Thanks for any pointers!
jlc
For creating PDFs from Python, consider:
ReportLab: Open Source Python Libraries for PDF creation
at http://www.reportlab.com/software/opensource/
I've used it successfully.
Gary Herron
--
https
. Try again with a full description of what
you want, and we'll try to provide a useful answer.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
aesthetically pure, and hence far
superior to any solution more mundane coders might produce.
That was uncalled for. There is already too much Nikos-bashing and
Nikos-basher-bashing (and so on) in this newsgroup without dredging up
even more in this completely unrelated request.
Gary Herron
. The OP had best ask the authors of the
application about using the application. Actual Python questions are
welcome here and will probably generate answers.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https
got os.path.dirname aliased to dn, so its dn(_code_file()) that I find
myself reaching for fairly often...
Huh? In what kind of a workflow are you running a python file without
knowing *what* file you are runnung?
Or am I just misinterpreting what this code does?
Confused but curious,
Gary
.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
On 11/10/2013 04:48 PM, Kennedy Salvino wrote:
Em domingo, 10 de novembro de 2013 21h34min39s UTC-3, Gary Herron escreveu:
On 11/10/2013 02:56 PM, kennedysalvino...@gmail.com wrote:
I'm trying to make a ranking of 3 numbers and say which the greatest and
consider whether there is a tie
volunteer help from this group, but the
question, as you've asked it, is a misuse (or even an *abuse*) of this
group.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
recommend some good ones for me? Thanks a lot!!
Try PythonCAD: http://sourceforge.net/projects/pythoncad/
(Google would have been faster. :-) )
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo
On 10/15/2012 06:55 AM, Debashish Saha wrote:
how to insert random error in a programming?
Drink several beers before you start programming. :-)
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo
= datetime.datetime.fromtimestamp(mtime)
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
On 12/03/2012 11:58 AM, subhabangal...@gmail.com wrote:
[(1,2), (3,4)]
L=[(1,2), (3,4)]
[b for a in L for b in a]
[1, 2, 3, 4]
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
http://mail.python.org/mailman/listinfo/python-list
spot you refer to it as cpu_temperature
and in another as cputemp.
If that's not it, you'd probably better show us your *real* code,
otherwise we're just guessing.
Gary Herron
--
http://mail.python.org/mailman/listinfo/python-list
On 12/22/2012 12:54 PM, KarlE wrote:
On Saturday, December 22, 2012 9:44:39 PM UTC+1, Joel Goldstick wrote:
On Sat, Dec 22, 2012 at 3:36 PM, Alexander Ranstam ran...@gmail.com wrote:
Hi!
Im totally new to Python, and im using it on my Raspberry pi. I found a program
that sends an email,
, these are extremely simple beginner problems, each
requiring only a few lines of code. Any programming class that assigned
these must have included some lectures on the basics of programming.
That's where he should start.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
to start the sequence off with [n] rather than [] so as to match
the suggested output.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
.
Then perhaps we can get to the bottom of this.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
are you trying to extend it?
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
of time. In fact, with what you've shown
us, you can eliminate the variable dateStrs, and both loops and be no
worse off.
Perhaps there is more to your code than you've shown to us ...
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
certainly need a loop (through the dictionary
entries), an 'if' conditional to test for the age matching the given
age, and a print,
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
what that project is. In
fact, I can't even figure out if your trouble is with the script, or
with using the script in this unknown project.
Also, if you repost, please include the script in the email, not as a
pointer to somewhere else.
Gary Herron
--
https://mail.python.org/mailman/listinfo
. Does your problem have anything to do with
Python?
* Is this a homework problem? We generally don't solve homework
problems here (since you don't learn anything that way), but we are
certainly happy to help you learn.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen
what you want, but
you'll have to do a much better job telling is what you want. While you
are at it, tell us what you've already done, and how it fails to do
whatever it is you want.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
incorrect results?
* I'm not likely to read your hundred+ lines of code trying to find a
bug. Please reduce you question to one or several lines of code,
what you expect them to do, and what they are doing that you
consider incorrect.
Gary Herron
--
https://mail.python.org/mailman
On 12/22/2013 10:37 AM, Frank Cui wrote:
hey guys,
I have a requirement where I need to sequentially execute a bunch of
executions, each execution has a return code. the followed executions
should only be executed if the return code is 0. is there a cleaner or
more pythonic way to do this
/functions.html#open for a list of
other modes available for the open call.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
to several variables, try:
def fn(...):
# calculate a and b
return a,b
p,q = fn(...)
All these comma-separated sequences are tuples, often written with
parentheses as (x,y)=(y,x) and (p,q)=fn(...), but as here, the
parentheses are often not necessary.
Gary Herron
--
https
Python is.
Gary Herron
handleMatch1(m)
elif m = r2.search(w):
handleMatch2(m)
else:
print(No match)
If the regular expressions are complex, running them multiple times
(once to test, another to capture groups) isn't ideal. On the other
hand, at present, one has to either do:
m
the whole post. That's
never a good idea.
After reading to the end, I rather like your suggestion. It works well
in your example, , nicely avoids the C/C++ trap, and has some
consistency with other parts of Python.
Gary Herron
On 02/01/2014 19:27, Gary Herron wrote:
On 01/02/2014 09:20 AM
by r -- expected to
be an integer).
Either of these remove the redundancy (but the first is more Pythonic)
for r in var:
helper = r.get()
or
for i in range(len(var)):
helper = var[i].get()
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
tracebacks are skills well
worth trying to develop. Good luck.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
names in two different namespaces.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
.)
Perhaps printing a traceback along with the exception would help. Add
traceback.print_exc()
Gary Herron
On 01/26/2014 10:17 PM, me wrote:
On Sun, 26 Jan 2014 21:04:57 -0800, Gary Herron wrote:
Never *ever* have a bare except like that. If it gets invoked, you have
no idea why. A simple typo like ixd instead of idx or a(idx) instead
of a[idx] would raise an exception but give you no idea why
have there, this jumping to (incorrect)
conclusions so quickly. We'd like to get to the bottom of this. (And
correct your mis-interpretations while we're at it :-)But we need to
see your test *and* the results.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
clearly not what you intended.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
a sequence into individual parameters:
fn(*(4*[[1,2,3]])) # note extra * preceding the arg
willl be a valid call for
def fn(a,b,c,d):
...
I'm sure other interpretations of your question are possible.
Gary Herron
what is the prefered method to realize this in Python?
any help would
On 02/03/2014 10:04 AM, Charlie Winn wrote:
On Sunday, February 2, 2014 9:46:24 PM UTC, Gary Herron wrote:
...
Sorry, but in fact you did *not* run this program as you claim. It's
full of syntax errors. Any attempt to run it will display syntax errors
immediately, and never actually run
an answer here, but I think
you'd have much better luck if you found a kivy specific newsgroup.
Good luck,
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
? That is: cut and paste
the *full* traceback instead of hiding useful information when you are
asking for help.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
.
If a and b had different keys, then you would get an error:
a = {'a':1}
b = {'b':2}
for x in a:
... print x
... print a[x]
... print b[x]
...
a
1
Traceback (most recent call last):
File stdin, line 4, in module
KeyError: 'a'
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
tell us, but that's
where the trouble is.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
in such a manner that
sys.argv[3] has such an odd value.
What does your command line look like? You didn't tell us, but that's
where the trouble is.
Gary Herron
how do you meen what does your command line look like?
When you run this python script, *how* do you do so?
Perhaps you type
to on this list.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
and runs Python with the rest of the
command line arguments is in control of this. If you can find a way to
tell your shell to not expand '*' characters, or find a shell that does
not do so, then yes, you can dispense with the back-slash.
Gary Herron
--
https://mail.python.org/mailman/listinfo
is what you are doing. (And it just
repeats the string a number of times -- not what you want.)
Your code used to have int(...) to convert the string supplied by
sys.argv into integers. What happened to them?
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
On 02/11/2014 01:18 PM, luke.gee...@gmail.com wrote:
Would it be possible to make an
int(sys.argv[1])
Not needed and set value 0 ( or in another script 1)
For example
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])
And I run
Python ./script.py 2 3
It just set c automaticly to 0
. The process is called string interning.
Google and wikipedia have lots to say about it.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
strategy to find them is a
good testing strategy.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
. (But don't ask
us to write the program for you.)
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
501 - 600 of 776 matches
Mail list logo