[RUBY] What is klass?

When I look at the source code of the library with python or ruby, it comes up a little. The keyword klass.

Although I was sensuously thinking "There is no such word in English ...", I went through it until a long time ago, but recently I came back when I hacked the contents of a certain ruby library. So I looked it up.

I can't name class so klass

You may not know what you are saying, but for example

def inspect_class(class)
  puts class.class
end

inspect_class('a')

When you want to write the code. This will result in a syntax error. Because the keyword class is already defined as a reserved word in ruby.

At that time

def inspect_class(klass)
  puts klass.class
end

inspect_class('a')

It will pass properly.

Imagewise

It is an impression that it is often written as an argument name of a method such as.

Especially in ruby's ActiveRecord, class (model) is often passed as an argument. (Rather, most frameworks do that.) I wonder if the keyword klass often appears in the ruby industry.

So, inspired by that, I feel like using python or something called klass.

that's all

As far as I can see the flow of the source, I believe that it is very important to hone my skills to investigate with interest in what I wondered, even though I thought "I'm sure that's the case", slightly or unconsciously. I will.

References

https://stackoverflow.com/questions/4299289/what-is-the-difference-between-class-and-klass-in-ruby

Recommended Posts

What is klass?
What is namespace
What is copy.copy ()
What is Django? .. ..
What is dotenv?
What is POSIX?
What is Linux
What is SALOME?
What is Linux?
What is python
What is hyperopt?
What is Linux
What is pyvenv
What is __call__
What is Linux
What is Python
What is a distribution?
What is Piotroski's F-Score?
What is Raspberry Pi?
[Python] What is Pipeline ...
What is Calmar Ratio?
What is hyperparameter tuning?
What is a hacker?
What is JSON? .. [Note]
What is Linux for?
What is a pointer?
What is ensemble learning?
What is TCP / IP?
What is Python's __init__.py?
What is an iterator?
What is UNIT-V Linux?
[Python] What is virtualenv
What is machine learning?
What is Minisum or Minimax?
What is Linux? [Command list]
What is Logistic Regression Analysis?
What is the Linux kernel?
What is an instance variable?
What is a decision tree?
What is a Context Switch?
What is Google Cloud Dataflow?
[DL] What is weight decay?
[Python] Python and security-① What is Python?
What is a super user?
Competitive programming is what (bonus)
[Python] * args ** What is kwrgs?
What is a system call
[Definition] What is a framework?
What is the interface for ...
What is Project Euler 3 Acceleration?
What is a callback function?
What is the Callback function?
What is a python map?
What is your "Tanimoto coefficient"?
Python Basic Course (1 What is Python)
What is Python? What is it used for?
[Python] What is a zip function?
[Python] What is a with statement?
What is labeling in financial forecasting?
What is Azure Automation Update Management?
[Python] What is @? (About the decorator)