Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28593

Re: Setting up a class

From "Colin J. Williams" <cjw@ncf.ca>
Newsgroups comp.lang.python
Subject Re: Setting up a class
Date 2012-09-06 09:41 -0400
Organization National Capital Freenet, Ottawa, Ontario, Canada
Message-ID <k2a97q$3ek$1@theodyn.ncf.ca> (permalink)
References <a451e907-5167-4e3e-a7f2-d63ffa0f2821@googlegroups.com> <mailman.298.1346934020.27098.python-list@python.org>

Show all headers | View raw


On 06/09/2012 8:20 AM, MRAB wrote:
> On 06/09/2012 13:00, shaun wrote:
>> Hi all,
>>
>> So I'm trying to to OO a script which is currently in place on work.
>> It connects to the database and makes multiple strings and sends them
>> to a server.
>>
>> But I'm having major problems since I am new to python I keep trying
>> to do it as I would do it in Java but classes seem to be very
>> different. I was wondering could someone answer a few questions?
>>
>> 1) Is there anything I should know about passing in variables from
>> another script to the class?
>>
>> 2) When I'm passing variables back to the script they seem to come
>> back blank as if I haven't done it correctly (I declare the empty
>> variable at the top of the class, I use the information I get from the
>> database to fill it and I send it back) Is there anything I'm not
>> doing right with this.
>>
>> 3)When I want to use a method from a class in another class method it
>> never seems to work for me, I have a feeling this is to do with "self"
>> but im not too sure??
>>
>> Any help would be appreciated.
>> Thanks,
>> Shaun
>>
> You should have a look as a Python tutorial to help you get used to the
> language. It shouldn't take you long, provided that you remember that
> Python isn't Java and don't try to write Java in Python. :-)
>
> Here's one you could look at:
>
> Python for Java programmers
> http://python4java.necaiseweb.org/Main/TableOfContents
>
The link given seems dated and incomplete - see "operator overloading".

Sorry I can't assist the OP.

Colin W.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Setting up a class shaun <shaun.wiseman91@gmail.com> - 2012-09-06 05:00 -0700
  Re: Setting up a class Joel Goldstick <joel.goldstick@gmail.com> - 2012-09-06 08:16 -0400
  Re: Setting up a class MRAB <python@mrabarnett.plus.com> - 2012-09-06 13:20 +0100
    Re: Setting up a class "Colin J. Williams" <cjw@ncf.ca> - 2012-09-06 09:41 -0400
  Re: Setting up a class Dave Angel <d@davea.name> - 2012-09-06 09:41 -0400
  Re: Setting up a class Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-06 17:23 -0400

csiph-web