canadadry
canadadry

Reputation: 8443

Define class variable which refers to a previous class variable in python

class Foo(object):
    a = "/admin'
    b = Foo.a + '/hello'

a refers to a base path. And I want to define the class variable b based on a. How do I achieve this ?

Upvotes: 1

Views: 79

Answers (1)

Winston Ewert
Winston Ewert

Reputation: 45039

class Foo(object):
    a = "/admin'
    b = a + '/hello'

Upvotes: 4

Related Questions