on perhaps unloading modules?

Hope Rouselle hrouselle at jevedi.com
Sat Aug 21 16:15:14 EDT 2021


Chris Angelico <rosuav at gmail.com> writes:

> On Sun, Aug 22, 2021 at 4:37 AM Hope Rouselle <hrouselle at jevedi.com> wrote:
>>
>> Greg Ewing <greg.ewing at canterbury.ac.nz> writes:
>>
>> > On 21/08/21 1:36 pm, Hope Rouselle wrote:
>> >> I wish I could restrict their syntax too, though, but I fear that's
>> >> not possible.  For instance, it would be very useful if I could
>> >> remove loops.
>> >
>> > Actually you could, using ast.parse to get an AST and then walk
>> > it looking for things you don't want to allow.
>>
>> Very interesting!  Thanks very much.  That would let me block them,
>> though the ideal would be a certain python.exe binary that simply blows
>> a helpful syntax error when they use something the course doesn't allow.
>> But surely the course could provide students with a certain module or
>> procedure which would validate their work.  (Don't turn in unless you
>> pass these verifications.)
>>
>> > You could also play around with giving them a custom set of
>> > builtins and restricting what they can import. Just be aware
>> > that such things are not foolproof, and a sufficiently smart
>> > student could find ways around them. (Although if they know
>> > that much they probably deserve to pass the course anyway!)
>>
>> So true!  If they can get around such verifications, they should present
>> their work at an extra-curricular sessions.
>
> Agreed... if they do it knowingly. On the other hand, if they just
> turn in code copied blindly from Stack Overflow...

When a student does something impressive, we should recognize it.
(Don't we do this with ourselves?  That's why we should.  Not because
it's a strategy to sort of encourage the behavior, but because it is our
culture.)  If if turns out they're clueless about their own feat, we
probably would notice by recognizing it in the first time.  Being so
cool, they could present it to everyone.  (This is not a strategy to
sort of catch plagiarism, but rather a sober modus operandi that seems
to work well.)  Copying blindly from somewhere could be the event that
triggers a deep interest.

One of the things that attracted me to computers was the keyboard.  Not
sure if it was the first thing.  But it's pretty.  One time I saw
Microsoft Windows and someone let me play on Paint.  I loved the Bézier
curves and some of the colors.  Then came the Internet.  Wow!  The
Internet brought me UNIX and I began to see computer code.  I was
impressed at how someone could just understand such things.  I wanted to
write some PHP precisely because it looked so much more cryptic than
Allaire ColdFusion.  Then C looked even more cryptic, so I fell in love
with C.

Maybe a little copy from wherever could be the spark for bigger things.
Education is a fantastically difficult thing and making mistakes seems
so involved with it that it's perhaps undetachable from it.  Of course,
we should stop ourselves from making irreversible mistakes such as
falling from a precipice.


More information about the Python-list mailing list