self Questions

2

Solved

I have this code to create an interface and some buttons (python in maya) class mrShadowMapChangerUI: def __init__(self): smAttrs = ['shadowMap','smapResolution','smapSamples','smapSoftness','s...
Parade asked 12/1, 2012 at 7:1

2

Solved

In Objective-c 2.0 why do subclasses need to reference instance variables in parent classes using the self keyword? Consider this example: // a.h @interface MyClass : NSObject @property (nonatomi...
Dyne asked 14/12, 2011 at 21:32

1

self.delegate = self; what's wrong in doing that? and what is the correct way of doing it? Thanks, Nir. Code: (UITextField*)initWith:(id)sender:(float)X:(float)Y:(float)width:(float)hieght:(int)tex...
Storms asked 17/11, 2009 at 10:0

4

Solved

Are you supposed to use self when referencing a member function in Python (within the same module)? More generally, I was wondering when it is required to use self, not just for methods but...
Dorey asked 11/10, 2011 at 5:59

2

Solved

I'd like to write some new Array methods that alter the calling object, like so: a = [1,2,3,4] a.map!{|e| e+1} a = [2,3,4,5] ...but I'm blanking on how to do this. I think I need a new brain. S...
Zorine asked 5/10, 2011 at 17:53

2

Yet another question on what the 'self' is for, what happens if you don't use 'self' and what's 'cls' for. I "have done my homework", I just want to make sure I got it all. self - To access an att...
Ambo asked 26/9, 2011 at 11:59

1

Solved

Using Xcode. In this code (func is declared in interface), tells subj error, standing on string with 'self'. + (void) run: (Action) action after: (int) seconds { [self run:action after:seconds ...
Priapitis asked 26/9, 2011 at 7:49

5

Just started learning python and I am sure its a stupid question but I am trying something like this: def setavalue(self): self.myname = "harry" def printaname(): print "Name", self.myname ...
Shively asked 11/8, 2011 at 10:41

3

Solved

Possible Duplicate: Python 'self' keyword Forgive me if this is an incredibly noobish question, but I never did understand self in Python. What does it do? And when I see thin...
Speaker asked 14/7, 2011 at 18:17

3

Solved

Possible Duplicate: What is the difference between Ruby and Python versions of“self”? Ruby and Python are similar languages that both have a self keyword used in various s...
Rutherfurd asked 12/7, 2011 at 22:7

4

Solved

From what I understand about self, it refers to the current instance of the class. Isn't this the default behaviour at all times anyways? For example, isn't self.var_one = method(args) equivale...
Plateau asked 12/7, 2011 at 18:56

4

Solved

Consider this example of a strategy pattern in Python (adapted from the example here). In this case the alternate strategy is a function. class StrategyExample(object): def __init__(self, strateg...
Agace asked 11/7, 2011 at 13:35

1

Solved

While adding model class to models.py in Django, why don't we use self with the field variables which we define? Shouldn't not using self field variables make them class variables instead,which "ma...
Princely asked 29/6, 2011 at 16:45

2

Solved

Is this code correct @implementation Vehicle +(id) vehicleWithColor:(NSColor*)color { id newInstance = [[[self class] alloc] init]; // PERFECT, the class is // dynamically identified [newInstanc...
Armor asked 14/4, 2011 at 17:43

6

Solved

When should I be using the self expression in my iphone development applications? say i have 2 fields: UITextField *text1; and NSString *str1; retained and synthesized. when i am accessing either...
Pagepageant asked 2/11, 2010 at 17:43

1

Solved

In testing a getter/setter pair in a rails model, I've found a good example of behavior I've always thought was odd and inconsistent. In this example I'm dealing with class Folder < ActiveRecor...
Strop asked 3/3, 2011 at 16:39

3

Solved

When do you use self.property_name in Ruby?
Cabe asked 21/2, 2011 at 16:13

4

Solved

Can anyone explain the difference between setting someObject = someOtherObject; and self.someObject = someOtherObject; if someObject is a class property created with @property (nonatomic, retain) S...
Indisposition asked 3/2, 2011 at 9:19

3

Solved

This is not specific for Rails - I am just using Rails as an example. I have a model in Rails: class Item < ActiveRecord::Base def hello puts "Hello, #{self.name}" end end (Let's assume...
Perrins asked 15/1, 2011 at 12:57

4

Solved

I know that self is the instance inside of an instance method. So, then, is self the class inside of a class method? E.g., Will the following work in Rails? class Post < ActiveRecord::Base def...
Fabyola asked 3/12, 2010 at 20:8

3

Solved

I have read a number of questions on this site about this issue, I understand the following: self.property accesses the getter/setter method created manually or by @synthesize. Depending upon whet...
Prescriptible asked 24/11, 2010 at 21:20

2

Solved

I have read the SO post on 'self' explained, and I have read the Python documentation on classes. I think I understand the use of self in Python classes and the convention therein. However, being...
Larine asked 22/11, 2010 at 21:4

5

Solved

I'm developing a documentation testing framework -- basically unit tests for PDFs. Tests are (decorated) methods of instances of classes defined by the framework, and these are located and instanti...
Bergeman asked 10/8, 2010 at 22:28

2

Solved

I recently was working on a little python project and came to a situation where I wanted to pass self into the constructor of another object. I'm not sure why, but I had to look up whether this was...
Flocky asked 15/10, 2010 at 20:35

2

Solved

I need to get pointer to my class instance inside this instance. I can't use "Self" directly, I need store pointer for future usage. I tried next code: type TTest = class(TObject) public class ...
Chrysalis asked 29/9, 2010 at 17:13

© 2022 - 2024 — McMap. All rights reserved.