Почти каждый дает , как прямо, позвольте мне показать эволюцию:
вы можете использовать методы экземпляра Array:
// general form of closure
images.sortInPlace({ (image1: imageFile, image2: imageFile) -> Bool in return image1.fileID > image2.fileID })
// types of closure's parameters and return value can be inferred by Swift, so they are omitted along with the return arrow (->)
images.sortInPlace({ image1, image2 in return image1.fileID > image2.fileID })
// Single-expression closures can implicitly return the result of their single expression by omitting the "return" keyword
images.sortInPlace({ image1, image2 in image1.fileID > image2.fileID })
// closure's argument list along with "in" keyword can be omitted, $0, $1, $2, and so on are used to refer the closure's first, second, third arguments and so on
images.sortInPlace({ $0.fileID > $1.fileID })
// the simplification of the closure is the same
images = images.sort({ (image1: imageFile, image2: imageFile) -> Bool in return image1.fileID > image2.fileID })
images = images.sort({ image1, image2 in return image1.fileID > image2.fileID })
images = images.sort({ image1, image2 in image1.fileID > image2.fileID })
images = images.sort({ $0.fileID > $1.fileID })
Для разработки объяснение о принципе работы, см. Сортированная функция .
PySAL 2.0 имеет новую структуру. Скоро появится исправление для GeoPandas (, как сегодня ). Вы можете либо подождать этого (версия 0.4.1), либо использовать GeoPandas от мастера через pip install git+git://github.com/geopandas/geopandas.git
. Или, альтернативно, понизьте PySAL до 1.x.