.
Use '%1d' % i to convert your number into a single character string.
Use sys.stdout.write to send exactly the characters you want to sys.stdout.
Thus: sys.stdout.write('%1d' % i) should do what you want.
Dr Gary Herron
Digipen Institute of Technology
--
http://mail.python.org/mailman/listinfo/python-list
Check out pySonic, a new FMOD wrapper written with Pyrex. Much more Pythonic.
gb
--
http://mail.python.org/mailman/listinfo/python-list
I haven't tried it on Linux but I believe it should work. FMOD works on Linux
as does Pyrex.
I don't think there is any win32 specific code. Grab the source and try
building it. You'll
likely have to fool with the libraries and includes in setup.py.
gb
Marian Aldenh?vel <[EMAIL PROTECTED]> wrot
ric.sqrt(a)
print Numeric.sqrt(b)
This would print
3
7
Note that the methods I want to create under program control are all
identical in form. In this example they all call the wrapped method with
an argument 42 greater than the value of the number.
Does anyone have an example where they've do
ld be able to sort it out from here
with the info you provided,
thanks again,
Gary
Rainer Mansfeld wrote:
Hi Gary,
you want your 'class factory' to change the methods of Numeric, so that
they accept foo objects and return foo objects?
I've not the slightest idea how to achieve tha
t would be better to do the same thing with class 'static'
methods, if this is possible, so that the methods are created just once.
Is this possible?
Gary
Rainer Mansfeld wrote:
If OTOH you want your foo class to have sqrt, arccos, etc. methods
without defining them explicitly, I thin
Thanks Steven and Kent, both of your suggestions look good to me. I'll
try both out and pick one.
Gary
Gary Ruben wrote:
OK, I've managed to get this to work with Rainer's method, but I
realised it is not the best way to do it, since the methods are being
added by the constru
I've noticed that the Perl camp has a very nice web/database environment
called Maypole. Ruby has the Rails environment which on the surface seems
similar to Maypole. I can't find anything in Python that ties a database
to a web interface anywhere near as well as Ruby on Rails or Maypole.
I see th
Two out of three on the home made approach I was thinking about.
Quixote, Cheetah and SQLObject.
Thanks for the link. I'm perusing it now.
deelan wrote:
> Gary Nutbeam wrote:
> (...)
>> Does anyone know of something similar to Rails or Maypole in Python?
>
> you may
I count zpt as xml because page templates can operate in html or xml mode.
This is not a troll. It is a lot of work in Zope to create interfaces to
relational data for anything more than simple data models.
It's a lot less work in Maypole or Rails, but I don't want to go back to
writing in Perl,
Thanks for the feedback. I should have been more specific though and
mentioned this has done on Linux (client and server).
D H wrote:
> Gary Nutbeam wrote:
>
>> I've noticed that the Perl camp has a very nice web/database environment
>> called Maypole. Ruby has the Rai
John J. Lee wrote:
I know mono runs on linux but I want nothing to do with it unless absolutely
necessary.
> Gary Nutbeam <[EMAIL PROTECTED]> writes:
>> D H wrote:
> [...]
>> > Check out Castle on Rails for .NET/Mono. It is still in early
>> > development, bu
Learning Ruby to use Rails is tempting.
Iwan van der Kleyn wrote:
> Gary Nutbeam wrote:
>> needing to learn Ruby.
>
> But why wouldn't you just use Rails and learn Ruby in the process? The
> "effort" required to learn Ruby pales in comparisson to the advantages
spencer wrote:
Hi,
I'm not sure why I can't concatenate dirname() with basename().
Of course you *can* concatenate them, but you're not getting that far.
The piece
os.path.dirname(os.getcwd)
should be
os.path.dirname(os.getcwd())
Then it will work without raising an exception, but
Has this bug been fixed in 2.3.5 or 2.4? Does it exist in XP systems?
#-
from Tkinter import *
def _onMouseWheel(event):
print event
root = Tk()
root.bind('',_onMouseWheel)
root.mainloop()
--
http://mail.python.org/mailman/listinfo/python-list
"Sean McIlroy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> There's something quite simple I'd like to do, but I'm hampered by
> lack of knowledge regarding Tkinter. If someone could help me out with
> a snippet of maximally-simple code showing, in general terms, how to
> do this,
Fernando Perez <[EMAIL PROTECTED]> wrote:
> Claudio Grondi wrote:
> > Considering what I found in the ipython mailing archives
> > and the fact, that after the fix with displaying colors on
> > bright backgrounds Gary had no time yet to get in touch
> > with me
ant.
If this sounds like an opportunity you'd be interested in, or if you
know of someone who might be a match, please let us know.
Thanks,
Gary
--
Gary Robinson
CTO
Emergent Music, LLC
[EMAIL PROTECTED]
207-942-3463
Company: http://www.goombah.com
Blog:http://www.garyrobinson.
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
will follow.
As a side note, 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
ever, the function itself looks correct otherwise, although you may
want 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
ed.
Then perhaps we can get to the bottom of this.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
you think the function class
is, and why are you trying to extend it?
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
a complete waste 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
oject", but we don't know 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 He
ython list. 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 Comp
thon is general enough to do 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
rk" tells us nothing. What error message, or what
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
conside
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 oth
the second parameter of the open call.
See http://docs.python.org/3/library/functions.html#open for a list of
other modes available for the open call.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
If you want a function to return several values 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
ckage not being installed. The
settings.py file has been properly annotated. Where should I put the
untared files in a typical Debian Wheezy installation.
All help will be sincerely appreciated.
Gary R.
--
https://mail.python.org/mailman/listinfo/python-list
nvinced, ... then sorry, that's just the way 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'
rry. I shot off my answer before reading 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
o return an element from the list (indexed 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
erstanding tracebacks are skills well
worth trying to develop. Good luck.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
t; associated with the same
object.
That's one object associated with three names in two different namespaces.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
ould differ slightly, but the advice is the same.)
Perh
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
ksome habit you 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
ke
1 = float(...)
don't make sense. It's as if you are trying to change the value of the
number one, but that's nonsense.
And lines like
print('Your Final Result is:', 5 * 6)
had better print out 30 (since that is what 5 times 6 is) but that's
clearly not what you intended.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
...
On the other hand expanding 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 real
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 actuall
might find 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
the
time to tell us what line produced that error? 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
as a key, so b[x] works.
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 "", line 4, in
KeyError: 'a'
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
tion is how you ran the program 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
--
https://mail.python.org/mailman/listinfo/python-list
ran the program 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, *h
for someone
to respond to on this list.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
ed command 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.
expect.
Multiplying a *string* by an integer 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 or
print(words)
...
['a', 'b', 'c']
['aa', 'bb', 'cc']
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https://mail.python.org/mailman/listinfo/python-list
't see string should be replaced by something else.
Could you tell me why I have such an error?
You are trying to use the *string* module without importing it, I'd guess.
Try:
import string
first then you should be able to access string.join without error.
Gary Herron
Thanks,
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https://mail.python.org/mailman/listinfo/python-list
g or how do I remove the duplicate list.
Gary R.
--
https://mail.python.org/mailman/listinfo/python-list
xpression. Also, it's a bad idea to use eval like
this, and it's a *really* bad idea to use eval with user supplied
input. The user could inject *any* malicious code.
Instead, use the importlib module to programmatically import a module.
Gary Herron
--
Dr. Gary Herron
Department o
ons are used to
separate :MM:DD. Is there a way to include this as a valid format?
Yes, there is a way to specify your own format. Search the datetime
documentation for
datetime.strptime(date_string, format)
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Ins
On 02/13/2016 12:27 PM, Tom P wrote:
On 02/13/2016 07:13 PM, Gary Herron wrote:
On 02/13/2016 09:58 AM, Tom P wrote:
I am writing a program that has to deal with various date/time formats
and convert these into timestamps. It looks as if
dateutil.parser.parse should be able to handle about any
reverse order:
for datum in reversed(data):
... whatever with datum ...
which wastes no time actually reversing the list, but simply loops
through them back to front.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
format(self.a, self.b) # Modify to suit
your needs.
...
>>> print(C(1,2))
C(a=1, b=2)
>>>
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https://mail.python.org/mailman/listinfo/python-list
whoever
wrote it into converting it to Python3.
Or my guess is completely wrong and the code is buggy and won't run
until fixed. (Which brings up the questions: What is cppdep.py? Who
wrote it? How do you know that it runs?)
Gary H
8, 10, 11, 13, 14, 16, 17, 19]
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https://mail.python.org/mailman/listinfo/python-list
ses 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
aving
files named py.py and __init__.py 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
ot with *opening* an image, but (if
you look at the error message) its with importing PIL.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
On 11/16/2014 12:54 AM, Pierre Quentel wrote:
Hi,
Version 3.0.0 of Brython has been released recently
Brython is an implementation of Python 3 running in the browser, with an
interface to DOM elements and events. It allows writing web client applications
with Python instead of Javascript.
Py
hat in Python?
The datetime module has lots of capabilities including the several you
mention.
See https://docs.python.org/2/library/datetime.html
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
.
I would use regular expressions. See
https://docs.python.org/3/library/re.html
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
nction, and the other the name of the
supplied default 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
m getting this (and so on) :
Traceback (most recent call last):
File "", line 1, in
abs._doc_()
AttributeError: 'builtin_function_or_method' object has 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
's way of returning a 1-byte string when indexing a string
(instead of returning an element of type character) allows this
surprising result.
>>> 'abc'[0]
'a'
>>> 'abc'[0][0]
'a'
>>> 'abc'[0][0][0]
'a'
&
ograms in Idle -- A reasonable GUI
environment 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 Windo
ch Fraction
>>>
>>> Fraction(1,2).is_integer()
False
>>> 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 Scie
r[0] = 123
>>> b
array([[123, 1],
[ 2, 2],
[ 3, 3]])
but the Python/numpy objects that wrap portions of that underlying array
of ints are all distinct.
Gary Herron
--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418
--
https://mail.python.org/mailman/listinfo/python-list
tegers. You can experiment with the cutoff on your
particular flavor of Python. On mine (Python 3.4.2 (default, Oct 8
2014, 13:08:17) ;[GCC 4.9.1] on linux)
it's somewhere between 200 and 300:
>>> 201 is 1+200
True
>>> 301 is 1+300
False
Gary Herron
--
Dr. Gary
nd
perhaps version) specific. 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
code, the best strategy to find them is a
good testing strategy.
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
't ask
us to write the program for you.)
Gary Herron
--
https://mail.python.org/mailman/listinfo/python-list
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
--
tuple is a Python data structure. 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
prints the global v
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 observi
displaying
images? (All 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
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
#x27;hs']
hs_2050s=swh_2050s.variables['hs']
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
n. 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/ma
d you do to try to get 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.pyth
jects, 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
t; output "not ok" ?
You are probably confusing yourself with the string "not ok". That
string, and any other non-empty string is considered true
>>> bool("not ok")
True
>>> bool("ok")
True
perhaps you meant
>>> n
t mentions "mutable" here -- that's
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 e
e smallest value representable
by a float, at which point it becomes zero.
To see 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
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 that a language accepts
#define MASK_SEPIA_INTERNAL_BLEEDING_WASHINGTON_DC_BLACK
, in
_parse_samples
digital_data_set = (sample_bytes.pop(0) << 8 | 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
dNode 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,
ready 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.
G
tually 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.
small 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
101 - 200 of 1014 matches
Mail list logo