Dear ALL,
I am a python beginner and has never programmed and has been struggling to
understand how to create objects or classes in python. Can anyone help with any
concrete example. I have read most recommended textbooks but still have
difficulties figuring what it is all about.
Thanks,
mbikinyi brat mbikinyi_b...@yahoo.com wrote
I am a python beginner and has never programmed
Welcome to the tutor list.
and has been struggling to understand how to create
objects or classes in python. Can anyone help with any
concrete example.
Most tutorials have examples of classes
Hi All,
This is a code I have written to calculate the area of a circle.
def area(radius):
temp=math.pi*radius**2
return temp
I now call it by entering area(12) at the prompt in IDLE. This is the error
message I get. Can someone help please?
Traceback (most recent call last):
File
Hi all,
This is my first post to this tutor list, so I hope you'll all get this
message :). I've bought last year a book on python programming (Learning
python from O'Reilly) to get started with python. I'm wanting to learn
python for two purposes: learning some webdevving (with django?) and
you need import math
On Wed, Apr 15, 2009 at 2:22 PM, mbikinyi brat mbikinyi_b...@yahoo.comwrote:
Hi All,
This is a code I have written to calculate the area of a circle.
*def area(radius):
temp=math.pi*radius**2
return temp*
**
*I* now call it by entering *area(12)* at the prompt in
Hi,
On Wed, Apr 15, 2009 at 7:29 PM, mbikinyi brat mbikinyi_b...@yahoo.com wrote:
Dear ALL,
When you type a code in IDLE-Python, they appear in different colours.
For instance:
def factorial(n):
if n==0:
return 1
else:
recurse=factorial(n-1)
result=n*recurse
return result
It's unlikely you are going to find a pdf on Python that's suitable for
beginners. Do you mean pdf or a digital book? There are Python books in
digital form on the web. I'm not quite sure how it works, but I know of
at least one public library has them. I think it works that if you have
a
Hi,
Sent an email directly to you before by mistake - sorry about that -
sending this to the list (tutor@python.org) directly - this way others
can answer too, and correct/improve my answers.
On Wed, Apr 15, 2009 at 7:41 PM, mbikinyi brat mbikinyi_b...@yahoo.com wrote:
Dear Oxymoron,
In my
Hi,
On Wed, Apr 15, 2009 at 6:52 PM, mbikinyi brat mbikinyi_b...@yahoo.com wrote:
Hi All,
This is a code I have written to calculate the area of a circle.
def area(radius):
temp=math.pi*radius**2
return temp
I now call it by entering area(12) at the prompt in IDLE. This is the error
Dear ALL,
When you type a code in IDLE-Python, they appear in different colours.
For instance:
def factorial(n):
if n==0:
return 1
else:
recurse=factorial(n-1)
result=n*recurse
return result
factorial in blue and return and else and result in red.
Any significance to these colours?
On Wed, Apr 15, 2009 at 3:43 AM, mbikinyi brat mbikinyi_b...@yahoo.com wrote:
Dear ALL,
I am a python beginner and has never programmed and has been struggling to
understand how to create objects or classes in python. Can anyone help with
any concrete example. I have read most recommended
On Tue, Apr 14, 2009 at 10:36 PM, Bill Campbell b...@celestial.net wrote:
On Tue, Apr 14, 2009, Emad Nawfal ( ) wrote:
Hi tutors,
How can I sort the following list in a way that takes care of the
right order of numbers? The sorted function compares strings here as
far
On Wed, Apr 15, 2009 at 3:50 AM, Evert Edel beat...@gmail.com wrote:
Hi all,
snip
Now since I've got the learning python book I first did a quick read trough
it and now I'm going more slowly trough it and doing all the explained
things (in the interactive prompt). I do understand the basics
On Wed, Apr 15, 2009 at 4:45 AM, Wayne Watson
sierra_mtnv...@sbcglobal.netwrote:
It's unlikely you are going to find a pdf on Python that's suitable for
beginners. Do you mean pdf or a digital book? There are Python books in
digital form on the web. I'm not quite sure how it works, but I know
Hi,
hope this mailing list is still active.
I'm learning phyton. I can write simple programs, and i've studied all
examples provided by the Google App Engine Documentation.
As i understood, i can import a module using something like:
import modulename
Or, import a specific function, using:
# This code is posted for the purpose of conversation. If it is of some
# value to someone that would be great. But what I hope is that the code
# sparks conversations about what I did in this code and why I did it. Since
# the list seems thick with OOP questions at the moment, I thought this
I have a python script that takes a text file as an argument. It then loops
through the text file pulling out specific lines of text that I want. I
have a regular expression that evaluates the text to see if it matches a
specific phrase. Right now I have it writing to another text file that
Spencer Parker wrote:
I have a python script that takes a text file as an argument. It then loops
through the text file pulling out specific lines of text that I want. I
have a regular expression that evaluates the text to see if it matches a
specific phrase. Right now I have it writing to
After he said that...I realized where I was being dumb...
On Wed, Apr 15, 2009 at 10:29 AM, bob gailer bgai...@gmail.com wrote:
Spencer Parker wrote:
I have a python script that takes a text file as an argument. It then
loops
through the text file pulling out specific lines of text that I
Since # the list seems thick with OOP questions at the moment, I thought
this might # be relevant. Digest and enjoy.
class Item ( object ):
def __init__( self ):
self._FullName = ''
self._Recovery = 0
self._Exporter = SimpleItemExporter (); # ? Don't
understand
But what I hope is that the code # sparks conversations about what I did in
this code and why I did it.
If anyone answers me thank you. really.
Nevertheless, I am personally not pursuing to understand this code. Ronald
Weidner left on vacation and won't be back until the 19th (I don't know
On Wed, Apr 15, 2009 at 12:27 PM, Carnell, James E
jecarn...@saintfrancis.com wrote:
Since # the list seems thick with OOP questions at the moment, I thought
this might # be relevant. Digest and enjoy.
class Item ( object ):
def __init__( self ):
self._FullName = ''
W W wrote:
On Wed, Apr 15, 2009 at 12:27 PM, Carnell, James E
jecarn...@saintfrancis.com mailto:jecarn...@saintfrancis.com wrote:
Since # the list seems thick with OOP questions at the moment, I thought
this might # be relevant. Digest and enjoy.
class Item ( object ):
Le Wed, 15 Apr 2009 08:29:30 -0700,
Weidner, Ronald rweid...@ea.com s'exprima ainsi:
# This code is posted for the purpose of conversation. If it is of some
# value to someone that would be great. But what I hope is that the code
# sparks conversations about what I did in this code and why
1. Python is not Java (see Philip Eby's blog entry
http://dirtsimple.org/2004/12/python-is-not-java.html). Let go of your
concepts that only Items can go into an ItemCollection - Python already has
some perfectly good collection builtins. Instead of writing a custom
ItemCollection, why not write
1. Python is not Java
although i agree with all 4 points that paul makes, this 1st one
stands out the most. when i saw the code the first time, the immediate
thought that came to my mind was, This looks like Java code written
with Python syntax. i thing the same functionality can be
accomplished
I must confess I do not really understand your intent
(a) with the code itself
(b) with the fact of publishing it
Maybe I have read it too fast. What I saw is an implementation of strict object
interface, in the sense strictly separating the inner and outer parts of an
object. Sure, this is an
Le Wed, 15 Apr 2009 12:20:20 -0700,
wesley chun wes...@gmail.com s'exprima ainsi:
i think it's a common style guideline in multiple
languages i'm familiar with (other than Python) to Capitalize class
names but keep variables, functions, and methods all lowered.
In most cases I know, class
i think it's a common style guideline in multiple
languages i'm familiar with (other than Python) to Capitalize class
names but keep variables, functions, and methods all lowered.
In most cases I know, class names are capitalized, while func and method
names are camel-cased:
ThisKlass
mbikinyi brat mbikinyi_b...@yahoo.com wrote
When you type a code in IDLE-Python, they appear in different colours.
For instance:
factorial in blue and return and else and result in red.
Any significance to these colours?
Yes, they indicate different syntactic features. You can change
them
1. Python is not Java (see Philip Eby's blog entry
http://dirtsimple.org/2004/12/python-is-not-java.html). Let go of your
concepts that only Items can go into an ItemCollection - Python already has
some perfectly good collection builtins. Instead of writing a custom
ItemCollection, why not
Giorgio Bonfiglio gg.lab...@gmail.com wrote
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
The first line imports the webapp subpackage (that is not actually a
module,
it's a subdirectory with some .py files into). So why do i need to
Weidner, Ronald rweid...@ea.com wrote
# This code is posted for the purpose of conversation. If it is of some
# value to someone that would be great. But what I hope is that the code
# sparks conversations about what I did in this code and why I did it.
Since
# the list seems thick with OOP
Emile van Sebille em...@fenx.com wrote
Redundant, yes; syntax error, no. IIRC, semi-colons are optional line
terminators.
statement terminators I think. ie you can have several statements
on a line by separating with semicolons:
x=5; print x+2
7
Alan G
Ronald -
I really encourage you to try to embrace some of the basic Python idioms as
part of your Java-Python journey:
1. Iterators
for item in list_of_items:
# do something with item
Is all that is needed to visit each item in a Python list. Your verbose
MoveFirst, MoveNext, if more
On Wed, Apr 15, 2009 at 6:57 PM, Alan Gauld alan.ga...@btinternet.com wrote:
When you import you import names, in the first case webapp.
Where the name is a package (ie a folder) that gives you access
to the modules (or sub packages) contained in that folder but
not to the contents of those
36 matches
Mail list logo