Tag: Operators
Posts of Tag: Operators
  1. comparing itemgetter objects

    I noticed that operator.itemgetter objects don't define __eq__, and so their comparison defaults to checking identity (is). Is there any disadvantage to defining two itemgetter instances as equal whenever thei...Learn More
    PythonOperatorspython-3.x
  2. Put spaces in between some of of the characters

    I want to put spaces only after and before of an mathematical operator: for example: 55/2*456-5+5 result: 55 / 2 * 456 - 5 + 5 ...Learn More
    StringJavaOperatorsReplace
  3. Implementing operator<< for a derived class

    So I have a base class (Shape) and three derived classes, Circle, Rectangle and Square (Square is derived from Rectangle) I'm attempting to implement operator<< which just calls the correct display functi...Learn More
    ClassOperatorsc++derived
  4. How do boolean operators work in 'if' conditions?

    I am currently new to Python and am trying to run a few simple lines of code. I cannot understand how Python is evaluating this syntax after the if statement. Any explanations will be appreciated. number = int(...Learn More
    PythonOperatorsBooleanif-statement
  5. Explain working of this C program

    Please explain working in each case. Why both cases have same output? Case I: int main (void) { int i = 5; if(i == ++i) //plz explain here How values are checked printf("Equal"); ...Learn More
    Operators
  6. meaning of '+='

    I'm confused with the syntax of C#: what is the use of "+="? ...Learn More
    C#.NETSyntaxOperators
  7. Understanding this class in python. The operator % and formatting a float

    class FormatFloat(FormatFormatStr): def __init__(self, precision=4, scale=1.): FormatFormatStr.__init__(self, '%%1.%df'%precision) self.precision = precision self.scale = scale ...Learn More
    PythonClassOperators
  8. Meaning of () => Operator in C#, if it exists

    I read this interesting line here, in an answer by Jon Skeet. The interesting line is this, where he advocated using a delegate: Log.Info("I did something: {0}", () =&gt; action.GenerateDescription()); Que...Learn More
    C#.NETOperatorsdelegates
  9. If statement, compare one variable to multiple

    Example: int value = someValue; if (value == (valueOne OR valueTwo OR valueThree)){ //do code } I would like to avoid re-typing value like in my example below. if (value == valueOne || value == valueTwo || val...Learn More
    JavaOperatorsif-statement
  10. Can I define a "not" operator in Python?

    I am trying to interface a C++ library that implements logical operators &&, ||, ! (unary operator not) to operate on custom selection classes. I'm a bit stuck because I can't find an unary 'not' oper...Learn More
    PythonOOPOperators
  11. Javascript operator !==

    What is the difference between the !== operator and the != operator. Does it behave similar to the === operator where it compares both value and the type? ...Learn More
    JavaScriptOperators
  12. PHP Shorthand Addition Operator - Undefined Offset

    I'm using the PHP shorthand addition operator to tally the number of times a specific id occurs within a multidimensional array: $source['tally'] = array(); foreach ($items as $item) { $source['tally'][$it...Learn More
    PHPArraysOperatorsForeach