Skip to content

Commit 739dd19

Browse files
committed
nicer
1 parent 75faf25 commit 739dd19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

example/classes.zig

+2-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ pub const GetAttr = py.class(struct {
179179
_ = self;
180180
}
181181

182-
pub fn __getattr__(self: *const Self, attr: py.PyObject) !py.PyObject {
183-
const attrName = try py.PyString.checked(attr);
184-
const name = try attrName.asSlice();
182+
pub fn __getattr__(self: *const Self, attr: py.String) !py.PyObject {
183+
const name = try attr.asSlice();
185184
if (std.mem.eql(u8, name, "number")) {
186185
return py.create(42);
187186
}

0 commit comments

Comments
 (0)