On 04/04/13 08:51, Phil wrote:
By the way, I notice that it can take several hours for my postings to
appear on the list. Possibly due to moderation?
Nope, the only posts that get moderated are the ones where the poster
has not subscribed to the list (or is using a different email address
th
On 04/04/13 13:12, Phil wrote:
On 04/04/13 11:58, Steven D'Aprano wrote:
On 04/04/13 12:47, Phil wrote:
And this is the error message;
"global name 'Ui_satListDialog' is not defined"
On its own, that is almost useless.
Python gives you more debugging information than that: it gives you a
c
On 04/04/13 16:58, Peter Otten wrote:
Phil wrote:
I think I must be very close now so I'll post just the code that I think
is relevant.
This the main window class:
import satListDialog
Here you are importing the module "satListDialog"
class MainWindow(QMainWindow, Ui_MainWindow):
This
Phil wrote:
> I think I must be very close now so I'll post just the code that I think
> is relevant.
>
> This the main window class:
> import satListDialog
Here you are importing the module "satListDialog"
> class MainWindow(QMainWindow, Ui_MainWindow):
>
> This is the function to show the
On 04/04/13 11:58, Steven D'Aprano wrote:
On 04/04/13 12:47, Phil wrote:
And this is the error message;
"global name 'Ui_satListDialog' is not defined"
On its own, that is almost useless.
Python gives you more debugging information than that: it gives you a
complete traceback, which include
On 04/04/13 12:47, Phil wrote:
And this is the error message;
"global name 'Ui_satListDialog' is not defined"
On its own, that is almost useless.
Python gives you more debugging information than that: it gives you a complete
traceback, which includes the actual line of code causing the prob
On 04/04/13 09:32, Alan Gauld wrote:
Reme,ber that in python its the file name you need to use to import
So if SatelliteListDialog is defined in satellite.py you need
import satellite
in your main window file.
And satellite.py has to be in your library path too...
The Eric IDE must take ca
On 04/04/13 09:32, Alan Gauld wrote:
On 04/04/13 00:14, Phil wrote:
If this was C++ then I'd need to include a class header and so I'm
thinking that an import statement is needed in the main window class
referring to the dialog class. Import SatelliteListDialog isn't correct.
Reme,ber that in
On 04/04/13 00:14, Phil wrote:
If this was C++ then I'd need to include a class header and so I'm
thinking that an import statement is needed in the main window class
referring to the dialog class. Import SatelliteListDialog isn't correct.
Reme,ber that in python its the file name you need to
Thank you for reading this.
The recent question relating to classes has prompted to ask this one.
I have a main window class and a dialog class and they are defined in
separate files. I'm attempting to display the dialog when a menu item is
selected in the main window but it doesn't work becau
On Sat, Feb 9, 2013 at 3:24 AM, Alan Gauld wrote:
> On 09/02/13 07:01, neubyr wrote:
>
>>
>> I am learning Python 2.7 classes and objects. It seems like attributes
>> (data attributes and methods) can be added to a class/object even after
>> it's first declaration. For example,
>>
>
> You can do
On 09/02/13 07:01, neubyr wrote:
I am learning Python 2.7 classes and objects. It seems like attributes
(data attributes and methods) can be added to a class/object even after
it's first declaration. For example,
You can do that, but mostly you shouldn't.
Usually when classes/objects are use
On 09/02/13 18:01, neubyr wrote:
I understand that all attributes are stored in a dictionary, but I am not
following when adding an attribute after initial declaration approach
should be used. The official documentation also suggests that valid
attributes are all the names present when the class
On 02/09/2013 02:01 AM, neubyr wrote:
> I am learning Python 2.7 classes and objects. It seems like
attributes (data attributes and methods) can be added to a class/object
even after it's first declaration. For example,
>
>
> class A(object):
> def __init__(self,arg):
> self.val1 = arg
>
> a
I am learning Python 2.7 classes and objects. It seems like attributes
(data attributes and methods) can be added to a class/object even after
it's first declaration. For example,
class A(object):
def __init__(self,arg):
self.val1 = arg
a = A(1)
print a.val1
Now another data attribute v
Hi all,
I've been working on creating 2D bounding box (envelope) classes to
describe spatial data. Variations of these are available in other
spatial libraries (e.g. Shapely), although I haven't found envelopes
specific to raster data that also specifies cell size. Could be I just
haven't fo
"Stefan Lesicnik" wrote
Caveat: I know zilch about pyGtk.
My question is maybe more generic with functions as opposed to classes,
but i've been trying some pyGtk and I am unsure how i get values back
from other classes.
They should be returned by the methods. So you just assign the method
r
Hi Guys,
I'm slowly starting to understand classes coming from basic non oo scripting. I
guess the problem comes in that you think you understand, and then look at code
and its totally different and confusing.
My question is maybe more generic with functions as opposed to classes, but
i've be
"spir" wrote
English is terrible. From wiktionary (abstracts)/
Indeed. and the fact that computer Scientists often abuse English
makes it worse!
header
Text, or other visual information, used to mark off a quantity of text,
often titling or summarizing it.
This is probaly the closest to
Le Sat, 7 Nov 2009 14:06:15 -,
"Alan Gauld" s'exprima ainsi:
> "C.T. Matsumoto" wrote
>
> > class Foo: # the book says this is a class header
> >pass
>
> Hmm, that's pretty dubious usage of header in my view.
> Its the class definition and there is nothing "header" about it.
Engli
"C.T. Matsumoto" wrote
class Foo: # the book says this is a class header
pass
Hmm, that's pretty dubious usage of header in my view.
Its the class definition and there is nothing "header" about it.
As for my question it looks like the convention is if a class only has
operator overload
Hugo Arts wrote:
On Sat, Nov 7, 2009 at 12:25 PM, C.T. Matsumoto wrote:
class indexer():
def ___getitem__(self, index):
return index ** 2
I thought I was missing some special style, or rule. The class above is take
from Learning Python, and there are several other examples too.
fo
On Sat, Nov 7, 2009 at 12:25 PM, C.T. Matsumoto wrote:
> Thanks Hugo,
>
> Do methods like __add__, __del__, count as built-in types? I'm aware of the
> rule you explained and use it and that's why when I saw:
>
Built-in types are only those classes 'built in' to the python
interpreter. They incl
Thanks Hugo,
Do methods like __add__, __del__, count as built-in types? I'm aware of the
rule you explained and use it and that's why when I saw:
class indexer():
def ___getitem__(self, index):
return index ** 2
I thought I was missing some special style, or rule. The class above i
On Sat, Nov 7, 2009 at 10:39 AM, C.T. Matsumoto wrote:
> yes,
>
> class Foo: # the book says this is a class header
> pass
>
> As for my question it looks like the convention is if a class only has
> operator overloading then the class receives a lowercase class name.
> If the class has a mix, o
yes,
class Foo: # the book says this is a class header
pass
As for my question it looks like the convention is if a class only has
operator overloading then the class receives a lowercase class name.
If the class has a mix, operator overloading and a normal method then
the class name gets sta
"C.T. Matsumoto" wrote
I'm reading Learning Python's section 'Operator Overloading' and I was
wondering why class headers that implement and overload are lowercase?
I'm not sure what you mean by class headers?
Can you post an example?
--
Alan Gauld
Author of the Learn to Program web site
Hello All,
I'm reading Learning Python's section 'Operator Overloading' and I was
wondering why
class headers that implement and overload are lowercase?
Cheers,
T
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
"Jojo Mwebaze" <[EMAIL PROTECTED]> wrote
Thanks Allan... we have used CVS for the base system.. but for users
provided functions, we think for having them persistent in the
database..
Thats what I don't understand. I can't think of a single good reason
to do that. I can see the point of putt
Jojo, am reading your problem correctly?
If you have (for example) x=2 and y=4, you want the database to return
functions like x+2, 2x and 3x-2? (I know this is probably much simpler
than the actual functions you'll be using).
And you the want to use those functions in your code?
@list: pi
Sorry Alan,
What u described below is exactly what i want to do.. if given x, y as two
datatums and such that f(x) --> y, given y can we determine f or x?
Assuming the x, y and f are stored in the database, then we can be able to
write queries to search/extract for the f's that are responsible f
> Thanks Allan... we have used CVS for the base system.. but for users provided
> functions,
> we think for having them persistent in the database..
I'm puzzled. CVS provides much better facilities for handling code, especially
with multiple
versions (visibility of diffs, who changed what and w
Thanks Allan... we have used CVS for the base system.. but for users
provided functions, we think for having them persistent in the database..
Cheers
Johnson
On Thu, Nov 13, 2008 at 7:18 PM, Alan Gauld <[EMAIL PROTECTED]>wrote:
>
> "Jojo Mwebaze" <[EMAIL PROTECTED]> wrote
>
> Because we have
"Jojo Mwebaze" <[EMAIL PROTECTED]> wrote
Because we have very many such cases, we can not incorporate such
adhoc
changes in the system.. we are thinking of storing such classes in
the
database and have classes run from the database. if anyone else
feels they
need to use someone's algorithm
Hello There,
I would like store python classes in a database and then execute these
classes from the database? Scientists do always want apply their own
algorithms at the same time we want to keep this information. (knowing which
class is responsible for which data)
Because we have very many such
"James" <[EMAIL PROTECTED]> wrote
Another question on classes in separate files...
It could just as well be about functions. The issue is about
visibility of names not classes.
main.py instantiates a class called 'testClass' inside of a file
temp.py.
In main.py:
t = temp.testClass()
...
"James" <[EMAIL PROTECTED]> wrote
The issue is, however, that I'm not sure the "best" way to pass
things
into classes, and the "best" way to get something back.
In an OOP syustem you don;t normally have to pass a lot into
a method since most of the data should be internal to the object
Often
Another question on classes in separate files...
main.py instantiates a class called 'testClass' inside of a file temp.py.
In main.py:
t = temp.testClass()
So now I can access some of the variables inside of 't'. For example,
let's say that in main.py, I do the following:
# get a variable fr
All,
I've started tinkering (just a little) with classes, primarily because
I have to. (I've never been a huge fan of OOP, but can tolerate it
when used properly).
I'll be the first to admit that I don't know much about how to program
"correctly" when dealing with objects, however, so any thought
On Sat, Jul 12, 2008 at 9:47 AM, Paul Melvin
<[EMAIL PROTECTED]> wrote:
> And how can i go about testing that i get appropriate values during the
> testing/building phase (generally speaking), is it lots of print/return
> statements and then remove them?
Take a look at the doctest and unittest mo
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Alan Gauld
> Sent: 12 July 2008 18:08
> To: tutor@python.org
> Subject: Re: [Tutor] Classes v2, thoughts/suggestions please
>
>
> "Paul Melvin" <[EMAIL PROTECT
"Paul Melvin" <[EMAIL PROTECTED]> wrote
i have come up with a working class for a square,
Well done. It might not be the most elegant solution on the
inside but it isn't too bad from the users point of view and thats
what you should aim for IMHO.
I was thinking about using *args to get may
Thanks to Alans insights i have come up with a working class for a square,
overcomplicated probably but it lays the groundwork for my polygon class
which will iterate over something to generate an n-sided polygon.
If anyone is interested in actually running/testing this you need to get
hold of pgyl
"Alan Gauld" <[EMAIL PROTECTED]> wrote
class Square:
def __init__(self,p1,p2,p3,p4):
self.points = [p1,p2,p3,p4]
def draw(self):
myTookKitDrawSquare(p1.x,p1.y, p1.col,
p2.x,p2.y, p2.col,
<[EMAIL PROTECTED]> wrote
1. What is the difference between a classmethod and a
staticmethod, and when would i use either?
Kent pointed you at the recent discussion but from your later
comments I thibnk its pretty safe to say that for now you don't
need to care. The vast majority of classes yo
On Fri, Jul 11, 2008 at 4:58 AM, <[EMAIL PROTECTED]> wrote:
> 1. What is the difference between a classmethod and a staticmethod, and when
> would i use either?
We discussed this recently:
http://thread.gmane.org/gmane.comp.python.tutor/47054/focus=47108
Kent
hi,I have two questions please:1. What is the difference between a classmethod and a staticmethod, and when would i use either?2. I want to create an object, presumably a class, to handle attributes of an open gl object.For example, if i wanted to create a 2d square i need 4 points, each with an x,
> Hi
>
> I was trying to learn about classes in Python and have been playing
> around but I am having a problem with the deepcopy function. I want to
> have a function that returns a clean copy of an object that you can
> change without it changing the original, but no matter what I do the
> origin
Michael wrote:
> Okay
>
> Just when I think I am getting it you throw this in.
You're welcome.
> So why does a become local to each variable but b seem global?
>
A better way to ask that is "why does a become an instance property but
b remain a class property?"
f.a = 3
This is an assignment
Okay
Just when I think I am getting it you throw this in. So why does a
become local to each variable but b seem global?
Michael
bob gailer wrote:
> Michael wrote:
>> Hi Michael
>>
>> Thanks for the quick reply, I think I get it. So becuase I did not
>> declare them withing the init method usi
Michael wrote:
> Hi Michael
>
> Thanks for the quick reply, I think I get it. So becuase I did not
> declare them withing the init method using self they are shared by every
> object that is created, even completely brand new ones?
>
> Is it normal practice to declare your variables in a class? I
"Michael" <[EMAIL PROTECTED]> wrote
> Is it normal practice to declare your variables in a class? I notice
> that you don't have to, you can create them as you go, but i thought
> declaring and initialising them in the class would make it easier to
> understand and see what the class is for and s
Hi Michael
Thanks for the quick reply, I think I get it. So becuase I did not
declare them withing the init method using self they are shared by every
object that is created, even completely brand new ones?
Is it normal practice to declare your variables in a class? I notice
that you don't hav
Hi Michael,
This is a very interesting example. You do indeed have two distinct
copies. The interdependence you are observing is because you have
defined CLASS-LEVEL variables (akin to static in Java) rather than
instance-level variables. This is because of their declaration
within th
Hi
I was trying to learn about classes in Python and have been playing
around but I am having a problem with the deepcopy function. I want to
have a function that returns a clean copy of an object that you can
change without it changing the original, but no matter what I do the
original change
"Ara Kooser" <[EMAIL PROTECTED]> wrote
> File "/Users/ara/Documents/yeast/oop_yeast_nocaps.py", line 87, in
>
>first_instance.print_world()
> File "/Users/ara/Documents/yeast/oop_yeast_nocaps.py", line 40, in
> print_world
>m, n = world['dimensions']
> NameError: global name 'world'
So taking the advice given my John, Kent, and Michael I reworked
the program and created a class for world. I was able to solve the
first several errors that came up as a I moved functions into class
methods but this one stumps me. The error I am getting is:
Traceback (most recent call last):
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of anil maran
> Sent: Thursday, June 29, 2006 12:51 PM
> To: Tutor
> Subject: [Tutor] classes and functions
>
> how to use classes and functions in python
> thanks
What do
> how to use classes and functions in python
> thanks
Most of the online tutorials, including mine, will have a section on
OOP.
Try reading one and if you have specific questions come back here
and we will try to answer them.
Alan Gauld
Author of the Learn to Program web site
http://www.freene
how to use classes and functions in python
thanks
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Tutor maillist - Tutor@python.org
http://ma
> I was just wondering, what magic can you do with classes?
You can define your own types. Thats what classes are for.
Those types can be as 'magic' as your imagination
(and programming skills!) allow.
> other classes are interesting to subclass? I've seen Object too, but
I
> don't understand wha
On Feb 1, 2005, at 23:08, Ismael Garrido wrote:
Hello.
I was just wondering, what magic can you do with classes? I mean,
things like "class Name(Exception)" or "class Name(threading.Thread),
which other classes are interesting to subclass? I've seen Object too,
but I don't understand what it doe
Hello.
I was just wondering, what magic can you do with classes? I mean, things
like "class Name(Exception)" or "class Name(threading.Thread), which
other classes are interesting to subclass? I've seen Object too, but I
don't understand what it does.
Thanks
Ismael
__
63 matches
Mail list logo