[swift-evolution] [Discussion] Swift for Data Science / ML / Big Data analytics

Chris Lattner clattner at nondot.org
Thu Nov 2 22:30:56 CDT 2017


> On Nov 2, 2017, at 1:58 PM, Rocky Wei via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi Chris and everyone else,
> 
> So PerfectlySoft made Perfect-Python months ago to help Swift import python objects and libraries. However, it may reduce the strong type checking. Any idea to avoid it?
> 
> https://github.com/PerfectlySoft/Perfect-Python <https://github.com/PerfectlySoft/Perfect-Python>
Cool, I wasn’t aware of this.  It looks like a straight-forward wrapper for the Python C API.  

Here are some random questions:

why do you make the conversions from Python types to Swift types non-failable?  This init I’d expect to be failable, for example:
https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L34 <https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L34>


I understand that you’re wrapping PyObject* with a class to get ARC behavior, but why make it “open”?  What does subclassability mean for your PyObj type?
https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L183


Why do you print errors when you throw, instead of including the details in the error that gets thrown?
https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L223 <https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L223>

Why include a fixed list of supported types, instead of using a protocol to make it extensible?
https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L260 <https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L260>

What’s this defer doing?
https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L423 <https://github.com/PerfectlySoft/Perfect-Python/blob/master/Sources/PerfectPython/PerfectPython.swift#L423>

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171102/efc058e2/attachment.html>


More information about the swift-evolution mailing list