Python to Scala Syntax Mapping
SkillDev toolsReference for translating Python syntax constructs (enums, dataclasses, type vars, protocols) to Scala equivalents.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Python to Scala Syntax Mapping skill
What this skill tells your AI
The instructions your AI receives, as published by cxcscmu/skilllearnbench in skills/b1-one-shot-claude-opus-4-6/python-scala-translation/python-scala-syntax-mapping/SKILL.md and read by ahel’s review.
Enums
Python Enum -> Scala sealed trait + case objects or Enumeration:
// Preferred: sealed trait for pattern matching exhaustiveness
sealed abstract class TokenType(val value: String)
object TokenType {
case object STRING extends TokenType("string")
case object NUMERIC extends TokenType("numeric")
}
Dataclasses (frozen=True) -> Case Classes
// Python: @dataclass(frozen=True) with default fields
// Scala: case class (immutable by default)
case class Token(value: String, tokenType: TokenType, metadata: Map[String, Any] = Map.empty)
TypeVar -> Type Parameters
// Python: T = TypeVar("T") -> [T]
// Python: T_co = TypeVar(covariant) -> [+T]
// Python: T_contra = TypeVar(contra) -> [-T]
// Python: NumericT = TypeVar("NumericT", int, float, Decimal) -> type class or union
Protocol -> Trait (structural typing)
// Python Protocol -> Scala trait
trait Tokenizable {
def toToken: String
}
Optional / Union
// Python: Optional[X] -> Scala: Option[X]
// Python: X | None -> Scala: Option[X]
// Python: Union[A, B] -> Scala: Either[A, B] or sealed trait or overloaded methods
Default Mutable Args
Python allows mutable defaults (anti-pattern). Scala avoids this:
// Python: def __init__(self, opts: dict = {}):
// Scala: def this(opts: Map[String, Any] = Map.empty)
Signals
- GitHub stars
- 83
- Forks
- 5
- Last commit
- Jul 2026
Advanced
- Catalog kind
- skill
- Gateway key
python-scala-syntax-mapping- Source
- github.com/cxcscmu/skilllearnbench