Hello All,
I want to build some classes by optimizing their design.
But I want to keep quite 'simples'. I have a XML document
which represents let's say some rules (id, description, value).
My first idea is to create an *docrules* class which holds my document.
This class will use 2 other ins
Hello,
I have this exercise :
Try each of the following formatted string operations in a Python shell and
record the results:
“%s %d %f” % (5, 5, 5)
“%-.2f” % 3
“%-10.2f%-10.2f” % (7, 1.0/2)
print ” $%5.2fn $%5.2fn $%5.2f” % (3, 4.5, 11.2)
But if I try in a python 2.7 IDLE enviroment
Hello Alan,
Oops, then I have a problem.
Im following this book : http://openbookproject.net/thinkcs/python/english2e/
which is the first link in the beginners tutorial page.
And it's talking about the string modules.
Roelof
Date: Wed, 25 Aug 2010 15:49:14 -0700
From: alan.ga...@
Andrew,
For starters you have some errors in the way you are trying to access
methods from within a class instances. For example in your code in line 7
and 8,
def main():
angle, vel, h0, time = getInputs()
cball = Projectile(angle, vel, h0)
zenith = 0.0
while cball.getY() >=
There are 2 ways to get the ypos value one is cball.ypos and another is
call.getY() both will give u the current ypos.
--nitin
On Thu, Aug 26, 2010 at 7:26 AM, Andrew Martin wrote:
> All I want to do is add a line that displays that maximum height the
> cannonball reaches. I created a variable z
On 8/25/10, Andrew Martin wrote:
> All I want to do is add a line that displays that maximum height the
> cannonball reaches. I created a variable zenith to store the highest y
> value. I then wanted to compare the current y value of the cannonball to
> zenith while the cannonballs y value is grea
> Any modern multi-tasking operating system will ensure than a while loop
> doesn't kill your computer's responsiveness. A decent operating system
> will still remain responsive even at 100% CPU usage. Even Windows does
> that!
Opinions vary. If you try this on a laptop, the end user will be qui
All I want to do is add a line that displays that maximum height the
cannonball reaches. I created a variable zenith to store the highest y
value. I then wanted to compare the current y value of the cannonball to
zenith while the cannonballs y value is greater than zero. If the
cannonballs current
Daniel,
Considering that Python is your first programming language, let's start
from the absolute beginning. Before you think about what a function object
is, try to understand what a function is. A function is a series of
python commands put together under a common heading or name in order
-
>
> Message: 5
> Date: Wed, 25 Aug 2010 01:28:47 -0700 (PDT)
> From: Albert-Jan Roskam
> To: Python Mailing List
> Subject: [Tutor] os.access unreliable?
> Message-ID: <502129.63760...@web110716.mail.gq1.yahoo.com>
> Content-Type: text/pla
"Andrew Martin" wrote
However, when I did so I got this error: "TypeError: unbound method
getY()
must be called with Projectile instance as first argument (got
nothing
instead) "
def main():
angle, vel, h0, time = getInputs()
cball = Projectile(angle, vel, h0)
cball is a Project
"Gregory, Matthew" wrote
. It seems like coding the Point class with multiple distance
methods
is not very flexible, especially if you wanted to iterate over those
methods
for any two points
Its flexible enough provided you keep the interface to points. In
other words
if the distance is
On 8/25/10, Wayne Werner wrote:
> On Wed, Aug 25, 2010 at 4:58 PM, Alex Hall wrote:
>
>> Hi all,
>> If I wanted to have a dictionary containing functions, could I pass
>> args to those functions? For example:
>> menu={
>> "option 1":f1,
>> "option 2":f2
>> }
>> How would I pass args to f1 or f2
On Wed, Aug 25, 2010 at 4:58 PM, Alex Hall wrote:
> Hi all,
> If I wanted to have a dictionary containing functions, could I pass
> args to those functions? For example:
> menu={
> "option 1":f1,
> "option 2":f2
> }
> How would I pass args to f1 or f2 in this case? TIA.
You sure could, becaus
Hi all,
If I wanted to have a dictionary containing functions, could I pass
args to those functions? For example:
menu={
"option 1":f1,
"option 2":f2
}
How would I pass args to f1 or f2 in this case? TIA.
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.face
I just starting programming and am trying to learn some python (ver 2.6). I
am reading Python Programming: An Introduction to Computer Science by John
Zelle. In chapter ten, the first programming exercise asks the reader to
modify code from the chapter (below) . The code I added is highlighted.
How
Steven D'Aprano wrote:
> Other than using numpy, probably the simplest solution is to just
> subclass tuple and give it named properties and whatever other methods
> you want. Here's a simple version:
>
> class Point(tuple):
> [snip]
>
> What it doesn't give you (yet!) is:
>
> * distance between
On Thu, 26 Aug 2010 05:40:33 am nitin chandra wrote:
> Hi all,
>
> I have been getting support on this from the list, but unfortunately
> now it has become URGENT that i get some solution to this problem i
> need to resolve.
Is it "URGENT" enough that you would consider paid support?
Or are you a
On Thu, 26 Aug 2010 04:18:28 am Greg Bair wrote:
> I'm assuming what you really want is :
>
> if letter in strng:
> print "true"
> else:
> print "false"
Oh I hope not... the above is better written as:
print letter in strng
(assuming you don't care about the difference between "True"
an
sorry missed; with current code IT is reading / prints ONLY first
lines for each 96 set of files are displayed. DOES NOT go the Next row
or the Next Set of Files.
PL PL ... give me the solution.
Thanks
Nitin
*
PR1 0.00 0.153436 0.016740 1.362566 -0.0311
Hi all,
I have been getting support on this from the list, but unfortunately
now it has become URGENT that i get some solution to this problem i
need to resolve.
What i have done is create FileA.CSV whose structure is as follows :-
(no blank spaces, this is just for representation)
/home/nitin/pa
"Daniel" wrote
another problem regarding understanding a concept- function object.
As I
said, I do not understand what a function object is, what it does,
and what
can I do with it?
You are actually using them all the time.
Every function in Python is a function object.
You can execute the
"Roelof Wobben" wrote
It's for learning purposed but I forget that de module string
has built in functions.Thank you for remainding it to me.
Its not the string module that Christian is referring to,
its the methods of string objects - different things:
You can do:
import string
string.
"Roelof Wobben" wrote
##
def remove_letter(letter, strng):
antwoord=""
for letter in strng:
print letter, strng
if letter in strng:
print "false"
else:
print "true"
return antwoord
##
Several issues:
1
On 08/25/2010 06:00 AM, Roelof Wobben wrote:
>
> Hello,
>
>
>
> I have this programm :
>
>
>
> def remove_letter(letter, strng):
> """
> >>> remove_letter('a', 'apple')
> 'pple'
> >>> remove_letter('a', 'banana')
> 'bnn'
> >>> remove_letter('z', 'banana')
On 8/25/2010 10:56 AM Emile van Sebille said...
>>> def test1(ii): print "my name is %s" % ii.func_name
...
Oops -- my bad editing s/b or once was:
def test1(ii): print "single ii is %s" % ii
___
Tutor maillist - Tutor@python.org
To unsubscribe
On 8/25/2010 9:56 AM Daniel said...
Hello again, seems like in my journey to learn Python I have stumbled into
another problem regarding understanding a concept- function object. As I
said, I do not understand what a function object is, what it does, and what
can I do with it? I'm currently readi
Hello again, seems like in my journey to learn Python I have stumbled into
another problem regarding understanding a concept- function object. As I
said, I do not understand what a function object is, what it does, and what
can I do with it? I'm currently reading Think python, but the book is not
c
Hi Tim and Steven,
Thanks a lot for your very useful replies!
Cheers!!
Albert-Jan
~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system, and public h
> Date: Wed, 25 Aug 2010 12:27:39 +0200
> From: cwi...@compuscan.co.za
> To: tutor@python.org
> Subject: Re: [Tutor] why does this fail
>
> On 25/08/2010 12:00, Roelof Wobben wrote:
> > Hello,
> >
> > I have this programm :
> >
> > def remove_letter(letter, strng):
> > """
> > >>> remove_lett
On Wed, 25 Aug 2010 03:25:12 pm Nitin Das wrote:
> The problem with this while loop is if your random value doesn't lie
> between the mentioned range then ur 100% cpu would be utilized. The
> one thing u can do is to sleep for some time lets say 0.5 sec after
> every while loop iteration , in this
On 25/08/2010 11:15, Steven D'Aprano wrote:
It also warns that os.access doesn't take into account network file
sharing permissions.
Heh. On Windows it doesn't take into account *any* file sharing
permissions :)
TJG
___
Tutor maillist - Tutor@pytho
On 25/08/2010 12:00, Roelof Wobben wrote:
Hello,
I have this programm :
def remove_letter(letter, strng):
"""
>>> remove_letter('a', 'apple')
'pple'
>>> remove_letter('a', 'banana')
'bnn'
>>> remove_letter('z', 'banana')
'banana'
>>> remove_letter('i', 'Mississippi')
On Wed, 25 Aug 2010 06:28:47 pm Albert-Jan Roskam wrote:
> Hi,
>
> Hi I'm using os.access to do a preliminary check to see if I have RW
> access, but it seems to be unreliable. In a dir for which I have only
> read access, os.access also says I have write access. This is under
> Windows 2000. I cou
Hello,
I have this programm :
def remove_letter(letter, strng):
"""
>>> remove_letter('a', 'apple')
'pple'
>>> remove_letter('a', 'banana')
'bnn'
>>> remove_letter('z', 'banana')
'banana'
>>> remove_letter('i', 'Mississippi')
'Mpp'
On 25/08/2010 09:28, Albert-Jan Roskam wrote:
Hi,
Hi I'm using os.access to do a preliminary check to see if I have RW access, but
it seems to be unreliable. In a dir for which I have only read access, os.access
also says I have write access. This is under Windows 2000. I could of course use
a t
Hi,
Hi I'm using os.access to do a preliminary check to see if I have RW access,
but
it seems to be unreliable. In a dir for which I have only read access,
os.access
also says I have write access. This is under Windows 2000. I could of course
use
a try-except and catch the IOError, but I'd l
"Carter Danforth" wrote
Anyhow, I can't seem to be executing any files in terminal for some
reason, in this case the file ex1.py:
C:\Users\Carter Danforth\python ex1.py
python: can't open file 'ex1.py': [Errno 2] No such file or
directory
ex1.py is located in "pythonpractice" on my desktop
"Karim" wrote
Is there any equivalent to JAVACC in python (or lex yacc) to create
grammary
for config or format file?
Thats kind of what ConfiogParser does - it gives you tools to
read/write
a config file.
If you don't mind the data not being human readable you could also
use the shelve
On Wed, Aug 25, 2010 at 12:56 AM, Greg Bair wrote:
>
> It's not that the value doesn't lie between the mentioned range.
>
> What I'm doing is randomly fetching an item from a list of dicts
> (multi-dimensional ones from a JSON response) and accessing a value from it,
> but not every item has the k
40 matches
Mail list logo