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,
Henry
"mbikinyi brat" 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 and objects.
Certainly
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 "", line
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 being
you need import math
On Wed, Apr 15, 2009 at 2:22 PM, mbikinyi brat 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
>
Hi,
On Wed, Apr 15, 2009 at 7:29 PM, mbikinyi brat 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
> factorial in bl
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 libra
Hi,
<>
On Wed, Apr 15, 2009 at 7:41 PM, mbikinyi brat wrote:
> Dear Oxymoron,
> In my previous example I had to import math for it to work . But in this
> code with the factorial, I have not imported anything yet when I call it
> with factorial(5), I get the result. How is this possible?
In thi
Hi,
On Wed, Apr 15, 2009 at 6:52 PM, mbikinyi brat 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
> message I get. Can
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?
Reg
On Wed, Apr 15, 2009 at 3:43 AM, mbikinyi brat 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 textbooks but still have
On Tue, Apr 14, 2009 at 10:36 PM, Bill Campbell 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 as I can
On Wed, Apr 15, 2009 at 3:50 AM, Evert Edel wrote:
> Hi all,
>
> 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 behind OOP
> and
On Wed, Apr 15, 2009 at 4:45 AM, Wayne Watson
wrote:
> 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 l
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:
fro
# 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 m
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
outp
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 an
After he said that...I realized where I was being dumb...
On Wed, Apr 15, 2009 at 10:29 AM, bob gailer 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 want. 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
class Item ( object ):
def __init__( self ):
self._FullName = ''
self._Recovery = 0
self._Exporter = SimpleItemExporter (); # Don't
understand
Bummer, I was hoping to consider myself at the tip of intermediate
python programming ...
This is the first time I h
"""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 kno
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
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 ):
def __init__( self ):
Le Wed, 15 Apr 2009 08:29:30 -0700,
"Weidner, Ronald" 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 I did it.
>
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
accomplish
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 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 names are capital
>> 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:
> Thi
"mbikinyi brat" 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 and see what they are
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
"Giorgio Bonfiglio" 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 import
the specific fun
"Weidner, Ronald" 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 questions at
"Emile van Sebille" 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 <> N
On Wed, Apr 15, 2009 at 6:57 PM, Alan Gauld 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 items directly, hence t
37 matches
Mail list logo