Questions tagged [operators]
Operators are symbols that occur in nearly all programming and coding languages, used for performing calculations, comparisons, and assignments of data. Use this tag for any questions relating to operators, in any language, including things such as syntax, behaviour and use.
operators
7,828
questions
-5
votes
1
answer
64
views
Comparison Operators result in Python
Why in Python print(bool(7>8)==False==True) results False, logically it should be True?
as bool(7>8) is False, therefore
False==False==True -> True==True -> True (NOT False)
as the ...
0
votes
1
answer
19
views
Why does the PHP spread operator in an Elasticsearch query return different results than hardcoding parts of the query?
I've got a problem that I'm not entirely sure I understand. I've got the following Elasticsearch query, written in PHP, with fuzziness matching hardcoded; this results in about an expected 1,500 ...
0
votes
0
answers
53
views
What does a caret and an equal sign (^=) do in Python? [duplicate]
I was looking at the solution to a Python problem, and in it was
int ^= num
I don't understand what it means.
When I searched for it, I got a bunch of posts explaining what the caret sign does on its ...
0
votes
1
answer
59
views
How to Implement operator-> for a Custom UniquePtr Class in C++? [duplicate]
I am trying to write my own implementation of unique_ptr in C++, and here is my UniquePtr header file:
#include <iostream>
template <typename T>
class UniquePtr
{
T* ptr;
public:
...
1
vote
1
answer
80
views
How does the arrow operator in haskell make sense in functions that take more than one parameter?
FYI: Second day into Haskell
MRE (what the function does, does not matter):
foo :: Int -> Int -> Int
foo x y
| x == y = x + y
| x < y = x
| x > y = y
This is what ...
0
votes
1
answer
61
views
How to parse search engine keywords input
I'm implementing a tool that lets users search for terms in texts. I'm currently focused on handling more complex input from the search.
The operators I am looking to support are :
| = OR
& = AND
...
2
votes
1
answer
77
views
How do I parse Python-style chaining operators in Haskell using parsec?
In the project I'm currently working on, I construct the expression parser in parsec. The code is something like:
opTable :: [[Operator Parser Expr]]
opTable =
[
-- ...
[ InfixL $ ...
2
votes
1
answer
47
views
Understanding Array comparison while using custom data types with numpy
i have a question regarding comparison with numpy arrays while using cusom data types.
Here is my code:
import numpy as np
class Expr:
def __add__(self, other):
return Add(self, other)
...
-1
votes
1
answer
55
views
friend operator << and >> in base class without child class but still called
Why is the operators << and >> called in base class if they are defined as 'friend' when calling << and >> in child class?
Code:
#include <iostream>
#include <memory&...
0
votes
1
answer
78
views
Use defined operators from base class in inherited class
Assume I have a base class
class Vector
{
public:
Vector(const std::vector<float> &elements);
static Vector add(const Vector &v1, const Vector &v2);
Vector Vector::...
1
vote
1
answer
22
views
ComputeError with polars dataframe while trying to pass a column expressions in a simple shift() operation
Sorry, I'm starting out in Polars. Is there a way to achieve the same functionality of the shift(n) function where n is a dataframe variable.
When I try:
df = pl.DataFrame({
"a": [1, 2, ...
0
votes
0
answers
22
views
How do I define a custom method for @ operator? [duplicate]
Numpy uses the @ operator for matrix multiplication between two arrays.
I have my own class for which I want to define a method using the @ operator.
How should this be done? I define my own __add__, ...
0
votes
1
answer
42
views
How to getline from txt file and check if it is correct with what the user inputed
I am creating a bank application.
So far, I can create an account. After that, it encrypts the data like password and SSN. After that, it takes me to the login function where I have to enter my user ...
0
votes
1
answer
39
views
How to use otel collector to collect some CRD resources?
Does there are any solutions that I can use to collect resources for Operators, Helm Charts, CRD hierarchies and CD configurations via otel collector? All of them are not build-in resources for ...
0
votes
0
answers
28
views
Airfllow: Having a Custom Sensor Operator inside of python operator
I have a dag task called check_file that is responsible to check the file in remote location.
check_file = PythonOperator(
task_id='check_file',
python_callable=check_file,
...