Skip to main content

Thread: Philosophical question on python syntax


i'm used fortran programming, , starting adventure me python, many people speak it. have made first toy program, opens file, reads content, , closes it. closing it, 1 uses:

file.close()

in fortran

close(file)

how did work mind of people developing python such think python syntax more readable or clear other one? or there fundamental reason using prevents fortran-style syntax being used? really, i'm asking bottom of heart, in hope understand.

instance, in python 1 writes

print 'something'

logic, should be

'something'.print()

or that. find strange.

code:
close(file)
is function call passing 'file' first argument.

code:
file.close()
is method call. 'file' object, , 'close' property of object.

need oop damaged brain understand basic concept. previous knowledge of c++ there...

regards


Forum The Ubuntu Forum Community Ubuntu Community Discussions The Cafe Philosophical question on python syntax


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support