Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
¿En línea si no?

Aquí hay parte del código. Necesito entender lo que hace este código:

 if instruction == "JOINT" or instruction == "ROOT": parent = joint_stack[-1] if instruction == "JOINT" else None joint = BvhJoint(words[1], parent) self.joints[joint.name] = joint

Cómo entender esta línea especial ->

 parent = joint_stack[-1] if instruction == "JOINT" else None

¿Este código es igual al código JS?

 if (instruction == "JOINT") { parent = joint_stack[-1]; } else { }

?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

El código JS equivalente sería:

 if (instruction == "JOINT") { parent = joint_stack[-1]; } else { parent = null; }

o más idiomáticamente:

 parent = instruction == "JOINT" ? joint_stack[-1] : null;

Esta expresión ternaria en Python:

 joint_stack[-1] if instruction == "JOINT" else None

es lo mismo que la expresión ternaria de JS:

 instruction == "JOINT" ? joint_stack[-1] : null
about 4 years ago · Juan Pablo Isaza Report

0

 parent = joint_stack[-1] if instruction == "JOINT" else None

Esto verificará que la "instrucción" sea igual a "JOINT" si es así, el último valor de la matriz joint_stack se asignará al padre, de lo contrario, None

about 4 years ago · Juan Pablo Isaza Report

0

El equivalente de JS sería

 const parent = (instruction === "JOINT")?joint_stack[-1]:null;

El acceso directo a la expresión condicional se agregó a Python 2.5. Consulte ¿Python tiene un operador condicional ternario?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!