Skip to content
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

Implement < and > Process object comparisons #27

Closed
giampaolo opened this issue May 23, 2014 · 4 comments
Closed

Implement < and > Process object comparisons #27

giampaolo opened this issue May 23, 2014 · 4 comments

Comments

@giampaolo
Copy link
Owner

From billiej...@gmail.com on February 26, 2009 12:42:59

It could be useful implementing < and > Process objects comparisons based
on PID.
Example:

>>> Process(50) > Process(30)
True
>>> Process(50) < Process(30)
False

Original issue: http://code.google.com/p/psutil/issues/detail?id=27

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From billiej...@gmail.com on February 26, 2009 04:42:54

Implemented as r177 .

Status: Verified

@giampaolo
Copy link
Owner Author

From billiej...@gmail.com on February 26, 2009 05:04:47

(reopening)
Should we raise an exception for => and <= operators?

Status: Started

@giampaolo
Copy link
Owner Author

From jlo...@gmail.com on February 26, 2009 10:35:45

Why wouldn't you just check if proc1.pid < proc2.pid in this case? Same for <= 
or 
=>

operators. The == operator made sense to override for the Process object so 
that 
you

could compare if two processes are actually the same (same PID, same arguments, 
same

executable), but I don't see a logical test case for Process(30) < Process(50) 
when

all you're really comparing is the PID. A process can be == (same as) another
process, but it can't really be less than or greater than another process, only 
the

PID can.

@giampaolo
Copy link
Owner Author

From billiej...@gmail.com on February 27, 2009 08:22:57

You're right. Using pid property makes much sense.
I'm going to revert r177 changes.

Status: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant