osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Not Defined error in basic code


On 3/14/19 3:49 PM, DL Neil wrote:
>>>> Just getting started with tutorials and such, and don't understand 
>>>> this -
>>> Did you answer the post asking which tutorial you were 
>>> following/copying?
>> Sorry - it is this -
>> https://www.learnpython.org/en/ ..
>> The section is on classes and objects - 
>> https://www.learnpython.org/en/Classes_and_Objects
>
>
> Wanted to check: Someone publishing the 'first code' in this thread as 
> training material, would have been 'unhelpful'.
>
> Those guys have a good reputation - if the code camp approach suits 
> the learner, rapid progress can be made.
>
> The examples they provide illustrate attributes being 'defined' with a 
> value. (unlike the first code 'here' which only listed attributes)
>
> This feature of Python's dynamic nature often confuses folk who come 
> from other, more rigidly defined, languages - there is no need to 
> declare "id" as an integer per-se, passing it an integer constant as 
> its value performs two tasks for the price of one!
>
> Advice (if I may): don't be too literal in attempting to write Python 
> the way you currently write xyz-language code.
>
> You may find it helpful to combine those tutorials with similar 
> information from additional sources, eg the Python docs site's 
> tutorial, other on-line books, 'dead-tree' sources, other on-line 
> training, etc. Whilst it seems like more work (it's certainly more 
> reading/scanning), two non-identical statements of 'the same thing', 
> will express things differently. Often something from one source that 
> is initially puzzling, when compared with another presentation of the 
> 'same', helps learners' minds go 'click' or to enjoy that 'ahah moment'.
>
> All the best...
Thank you sir. I think you may be on to something there. I've done 
mainframe, machine, 3GL, and 4GL languages, but the last couple I've 
taken on have given me headaches. I guess I'll have to just read a bunch 
first and then try and write something simpler than what I'm attempting 
to take on... Thanks for your help and understanding.