6
\$\begingroup\$

This question was asked here about an hour ago. @Mast was kind enough to explain what was wrong with the first revision and pointed OP to the help center. OP then revised the question (revision 2) to include more context. I found it looked hypothetical, judging by names like MyClass and f, the # stub comment and the rather meaningless docstring. I commented:

The class seems pretty hypothetical still (with names like MyClass and comments like # stub). Please edit your question to include the actual code you're using.

To which OP replied:

This is the actual code I'm using. I haven't implemented the other functions yet, and I was hoping to just get the code implemented thus-far reviewed. ... [omitted]

The question got put on hold as off-topic about 15 minutes later. Was this justified?

Further, the code was apparantly 'not working as expected', but OP never mentioned that, nor does it contain any obvious problems regarding syntax (or even anything that could raise a NameError). Did anybody run it?

\$\endgroup\$
8
\$\begingroup\$

First revision was definitely worthy of closure and that's when I left mine. The second revision is a bit odd, even with the comment in mind. Take a look at the tail of the code:

    def f(self, event=None):
        print 'in f()'
        return 'hello world'

    def get_image_list(self):
        pass

    def next_image(self):
        pass

    def previous_image(self):
        pass

    def load_image(self):
        #stub
        pass

    def update_image(self):
        pass

root = Tk()
abc = MyClass(root)
root.mainloop()

print 'abc has been defined'
print '"abc.f()" returns "%s"' % abc.f()
#print str(abc.f)
#print repr(abc.f)

print 'end'

It screams stub code to me. Screams! Hello world? End? The only thing this code does is bind a key to a GUI. And honestly, that's ok. The title is quite explicit about that. But there are a lot of placeholders there raising questions leading to the understandable but false assumption the code isn't reviewable.

OP did a good job in thinking ahead and already putting in place the placeholders for functions the code will have later. Yes, that's stub code. But the question wasn't about that code. It was about the binding. Yes, technically we would be correct in leaving it closed. Yes, we can be a bunch of pedants about it. Let's not. Part of it can be explained as example usage and the rest is simply code not doing anything yet. Which is ok, since it isn't called either. It's dead code, there for the future. The rest is perfectly reviewable.

With that cleared up, I've voted to re-open. Thanks for bringing it up.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .