Lesson 13 (2019) discussion and wiki

Yes, all the while keeping a state, like regular jupyter.

1 Like

Does swift have args and kwargs concepts?

anything like args , kwargs in swift ?

2 Likes

You can define a function with a default argument value.

1 Like

You have labelled arguments or unlabeled arguments, but not *args or **kwargs that you can shove down another function.

2 Likes

Not yet… :wink:

2 Likes

Can real and imag be different type? like real being float, and imag being int?

1 Like

In this case, they’re required to be the same type. You can write the code slightly differently to allow them to be independent if you’d like.

For example:

struct Complex<T: SignedNumeric, U: SignedNumeric> {
    var real: T
    var imag: U
}
2 Likes

Nope, not with one generic. You could define a struct with two generic types however.

2 Likes

How did you learn Swift and write all those notebooks without a debugger?! #respect :slight_smile:

8 Likes

Fortunately there was the whole S4TF team to help :wink:

6 Likes

How does a + operator work if you are adding two different types where the LHS object and RHS object have different implementations of +?

1 Like

I’m guessing import Python gets its python libraries (eg matplotlib) from the python environment that was active when you started Jupyter?

Does tab complete and shift+tab work?

1 Like

So with python interop in S4TF one could use Pytorch right?

1 Like

The environment you linked your installation to.

How does typing work with Python-imported objects?

3 Likes

Tab complete works! We’ll do shift+tab eventually!

7 Likes

How are types imported from Python into Swift if Python is untyped?

3 Likes

They will answer that question really soon :wink:

2 Likes