-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should detect Table.with_columns() and warn the user #333
Comments
This seems a bit harder than it looks. Since the number of arguments checked is on runtime, the TypeError caused when someone uses |
In particular, add something like this to the start of
or
|
OH, I was looking at with_column rather than with_columns! So this is completely possible with with_columns, but not with with_column - but I'd say that the behavior should be identical (in relation to the warning due to the relationship between the methods). However, as noted above, this wouldn't be possible. Do you think it'd be okay to put a check on with_columns and not with_column? |
Asking students to distinguish between with_column and with_columns didn’t
work, last time I taught. Anything we can do to make those methods synonyms
would be a net benefit, I think.
…On Wed, Jul 3, 2019 at 1:09 AM Adnan Hemani ***@***.***> wrote:
OH, I was looking at with_column rather than with_columns! So this is
completely possible with with_columns, but not with with_column - but I'd
say that the behavior should be identical (in relation to the warning).
However, as noted above, this wouldn't be possible.
Do you think it'd be okay to put a check on with_columns and not
with_column?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#333?email_source=notifications&email_token=AACOFELC64WE5P4NVWTUYOLP5QYBDA5CNFSM4FWVZHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZDI3OQ#issuecomment-507940282>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACOFELDGBM5PYZ7Z45IBC3P5QYBDANCNFSM4FWVZHNQ>
.
|
Yes, it's fine to put the check on with_columns and not with_column. This isn't changing any semantics or behavior; it's just adding a warning about one common student error. If we can't warn for all student errors, it's still useful to warn for some of them. |
A common error that I see from students is to write code like
Table.with_columns('x', arr)
, when they should have usedTable().with_columns('x', arr)
. I suggest we try to detect that.I suspect we could add a check at the start of the
with_column()
method to issue an error iftype(self)==str
, or maybe more broadly iftype(self)!=Table
(as I don't think we expect anyone to subclass Table).The text was updated successfully, but these errors were encountered: