'join' in the wrong word for the method in class Thread.

C

castironpi

'join' in the wrong word for the method in class Thread.

The agent-patient semantics of calling functions can get ambiguous.
It is not a problem of native Pythoners alone. Is it due to lazy
programming, an inability of English (do you have it in other
languages?), or not a problem at all?

th1.join() doesn't mean, 'do something to th1', or even, 'have th1 do
something to itself.' In fact, if anything is doing anything
differently, taking waiting to be doing something different, it's the
caller.

Translating literally,

th1.join() -> join me here, th1.

And,

file1.close() -> close yourself, file1.

But not,

th1.join() -/> join yourself, th1.

Worse,

lock1.wait() -/> wait, lock1. (For what?)

Furthermore, in toolbars:

File -> Open -/> file an open.

and:

File -> Load -/> load a file. (It means, load the computer.)

In English, the placements of identifiers isn't consistent. IOW,
there isn't a syntactic mapping into natural language sentences.
(Though you can do it in Latin, German, Sanskrit, and Russian with
case markers*.) What are the true literals? What's doing what?

th1.join() -> 'be joined by th1'
file1.close()-> 'close file1'
lock1.wait()-> 'getinlinefor lock1'

And of course, 'open' isn't a method of File objects at all. The
closest is, 'be loaded by file1'.

Assuming speakers** of classical computer languages use OVS order--
object-verb-subject***, the most literal transformations are:

th1.bejoinedby()
file1.close()
lock1.getinlinefor().

The mapping of identifiers to English isn't consistent. It takes some
knowledge to read them-- shuffle an English sentence and it changes
meaning.

Functional languages are one long sentence: True.**** Declarative
ones tell a story. ('th1' joins him.) Imperatives command an
impartial audience.

What do the docs say about it?

'''
Thread.join([timeout])
Wait until the thread terminates. This blocks the calling thread until
the thread whose join() method is called terminates - either normally
or through an unhandled exception - or until the optional timeout
occurs.

When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in
seconds (or fractions thereof). As join() always returns None, you
must call isAlive() after join() to decide whether a timeout happened
- if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will
block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the
same exception.
'''

The natural language meaning of 'join' isn't used. Do benevolent
dictators do this? What do malevolent ones call themselves?


*Latin, German, Sanskrit, and Russian can do it. Latin, German,
Sanskrit, and Russian -speakers- can do it.
**It would be interesting to try to learn a language without ever
speaking it.
*** English is SVO, subject-verb-object. French is too, unless the
object is direct: subject- direct-object -verb.
**** The sum of the first three integers in the last two files, sorted
alphabetically, in 'c:\programs'.
 
B

Benjamin

'join' in the wrong word for the method in class Thread.

The agent-patient semantics of calling functions can get ambiguous.
It is not a problem of native Pythoners alone. Is it due to lazy
programming, an inability of English (do you have it in other
languages?), or not a problem at all?
This is what Java uses, and Python's threading module tries to imitate
it.
th1.join() doesn't mean, 'do something to th1', or even, 'have th1 do
something to itself.' In fact, if anything is doing anything
differently, taking waiting to be doing something different, it's the
caller.

Translating literally,

th1.join() -> join me here, th1.

And,

file1.close() -> close yourself, file1.

But not,

th1.join() -/> join yourself, th1.

Worse,

lock1.wait() -/> wait, lock1. (For what?)

Furthermore, in toolbars:

File -> Open -/> file an open.

and:

File -> Load -/> load a file. (It means, load the computer.)

In English, the placements of identifiers isn't consistent. IOW,
there isn't a syntactic mapping into natural language sentences.
(Though you can do it in Latin, German, Sanskrit, and Russian with
case markers*.) What are the true literals? What's doing what?

th1.join() -> 'be joined by th1'
file1.close()-> 'close file1'
lock1.wait()-> 'getinlinefor lock1'

And of course, 'open' isn't a method of File objects at all. The
closest is, 'be loaded by file1'.

Assuming speakers** of classical computer languages use OVS order--
object-verb-subject***, the most literal transformations are:

th1.bejoinedby()
file1.close()
lock1.getinlinefor().

The mapping of identifiers to English isn't consistent. It takes some
knowledge to read them-- shuffle an English sentence and it changes
meaning.

Functional languages are one long sentence: True.**** Declarative
ones tell a story. ('th1' joins him.) Imperatives command an
impartial audience.

What do the docs say about it?

'''
Thread.join([timeout])
Wait until the thread terminates. This blocks the calling thread until
the thread whose join() method is called terminates - either normally
or through an unhandled exception - or until the optional timeout
occurs.

When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in
seconds (or fractions thereof). As join() always returns None, you
must call isAlive() after join() to decide whether a timeout happened
- if the thread is still alive, the join() call timed out.

When the timeout argument is not present or None, the operation will
block until the thread terminates.

A thread can be join()ed many times.

join() raises a RuntimeError if an attempt is made to join the current
thread as that would cause a deadlock. It is also an error to join() a
thread before it has been started and attempts to do so raises the
same exception.
'''

The natural language meaning of 'join' isn't used. Do benevolent
dictators do this? What do malevolent ones call themselves?

*Latin, German, Sanskrit, and Russian can do it. Latin, German,
Sanskrit, and Russian -speakers- can do it.
**It would be interesting to try to learn a language without ever
speaking it.
*** English is SVO, subject-verb-object. French is too, unless the
object is direct: subject- direct-object -verb.
**** The sum of the first three integers in the last two files, sorted
alphabetically, in 'c:\programs'.
 
C

castironpi

On Mar 15, 7:29 pm, (e-mail address removed) wrote:> 'join' in the wrong word for the method in class Thread.


This is what Java uses, and Python's threading module tries to imitate
it.

If everybody's using join, then everybody's using join. That by
itself doesn't constitute a case that the practice, the trend, is
either right or wrong. Which is why I bring it up!

Upon some second thoughts, the OP (myself) could use a few more
examples... maybe even some parameters. Maybe even a spell checker
(subject line).
th1.join() -> 'be joined by th1'
file1.close()-> 'close file1'
lock1.wait()-> 'getinlinefor lock1'

One approach is to take a 'declarative' perspective: make them
statements instead of commands.

th1.join()
-> th1.joins()
file1.close()
-> file1.closes()
lock1.wait()
-> lock1.becomesfree()
htmlparser.reset()
-> htmlparser.resets()
htmlparser.feed( data )
-> htmlparser.eats( data )
pickle.dump( obj )
-> pickle.dumps( obj )
pickle.dumps( obj )
-> pickle.sdumps( obj )
socket.accept()
-> socket.accepts()

I tried once but got frustrated because the libraries wouldn't fit in.

lock1.becomesfree() is a fine example. It's saying what happens in
that statement, which is a lot closer to what's actually going on--
because lock is doing exactly nothing until something else in some
other story line. thread1.joins() similarly.

I do contend that names are hard to pick-- "one-worders" take
perspective and distance, which are pricey pricey-- and unfortunately
deadlines press and the existing ones come already to be used. Of
course, Python version graduation is a fine time to make the change,
but I'm no good at asking politely-- the right people at the right
times and in the right ways. A tool might be able to convert the
obvious cases automatically, and prompt the operator about any
residue. He wouldn't necessarily even have to change overridden
methods by hand either!

Multi-control systems may have cause the rift. Without them, 'do it'
is the same as 'it does it'. With them, 'he does it' and 'you do it'
are different. However the popularity of object-orientation may be
the culprit: not all of our instruction names made the jump right.
Maybe both.

Aside: The docs are heavily (-heavily-) in the patient (passive) voice
too: code.interact: "is passed", "is then run", "is discarded", as
well as alternate between declaration and command. But -you- rewrite
them, Mr. Backseat Driver! A lot of abbreviations 'recv', 'del',
'dir', and 'stat' can go. I digress.

The language would be changing pretty deeply: returns, yields, passes,
dels, raises, breaks, continues, imports. The 'returns' would even
move over: retval returns; object() returns; match returns (return
retval, return object(), return match). Maybe there's a language out
there that understands!

The inconsistency is in the address of threads and synchro. objects:
The author changes audiences. In th1.join(), he is not commanding his
audience to join th1. Biggest problem. It's like an implicit 'the
self thread' shows up from dreamworld or something.

th1.join( this_thread )
lock1.waitfor( a_goahead )
lock1.waitfor( someone_else_to_finish_up )

I'm not holding that the functions aren't defined. I'm saying the
names are hastily chosen.

The join documentation doesn't use the word 'join'. Event.wait
doesn't use wait, but Condition, os, and subprocess do.

"Event.wait( [timeout])

Block until the internal flag is true. If the internal flag is true on
entry, return immediately. Otherwise, block until another thread calls
set() to set the flag to true, or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a
floating point number specifying a timeout for the operation in
seconds (or fractions thereof). "

Aside: The rage-against-the-machine/paranoia/conspiracy-theory side of
me tries to ascribe malice to the writers, saying "they" were
"holding" "me" "down" (referring to my nose, of course). I know
better, but college was rough and the girlfriend pulled, so I don't
always catch it. Cough.

My earlier use of 'lazy' may have been a bit pejorative. It
insinuated the authors devoted time to Doritos over better names,
rather than just other names or even bugs. I was in a different
setting then -and- on autopilot. It proves my point, though. Time is
scarce.

Help me ask the right way!
 
E

Erik Max Francis

'join' in the wrong word for the method in class Thread.

That's the standard term in threading. If it's not familiar to you,
well, bummer, but there's not much more that can be done about that than
for you to read the literature.
 
C

castironpi

That's the standard term in threading.  If it's not familiar to you,
well, bummer, but there's not much more that can be done about that than
for you to read the literature.

Do you agree that it's inconsistent?
 
T

Torsten Bronger

Hallöchen!

[...]
*** English is SVO, subject-verb-object. French is too, unless the
object is direct: subject- direct-object -verb.

Really? I thought this is only the case for pronouns.

Tschö,
Torsten.
 
C

castironpi

Hallöchen!

[...]
*** English is SVO, subject-verb-object.  French is too, unless the
object is direct: subject- direct-object -verb.

Really?  I thought this is only the case for pronouns.

Yes, yes, I remembered that later on tonight. A complete
misformulation... sigh. Subject objective-pronoun verb objective-
noun(-phrase). What factors in to L'Academie Francaise's decisions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top