Last active
March 20, 2023 04:02
-
-
Save cuckookernel/9777067 to your computer and use it in GitHub Desktop.
Revisions
-
cuckookernel revised this gist
Apr 1, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | `range(10,4,-2)` | `[10:-2:4]` | Do this only if you really have to, as it will consume memory proportional to the length of the range | | `id( obj )` | `object_id( obj )` | | | `raise excetion` | `throw( exception )` | | `obj.fun( x, y)` | `fun( obj, x, y)` <br/> with [Lazy.jl](https://github.com/one-more-minute/Lazy.jl) <br/> @> obj f(x,y) | ## Basic String operations | *Python* | *Julia* | | -------------------------|-----------| -
cuckookernel revised this gist
Mar 31, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,9 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr ## Core [Getting around: All objects](http://docs.julialang.org/en/release-0.1/stdlib/base/#all-objects) | *Python* | *Julia* | *Comments* | | -------------------------|---------|----------| | `True` | `true` | | -
cuckookernel revised this gist
Mar 31, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr ## Core [Getting around: All objects](http://docs.julialang.org/en/release-0.1/stdlib/base/#all-objects) | *Python* | *Julia* | *Comments* | | -------------------------|---------|----------| | `True` | `true` | | -
cuckookernel revised this gist
Mar 31, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,7 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | `xrange(10,4,-2`)` | `10:-2:4` | | | `range(10,4,-2)` | `[10:-2:4]` | Do this only if you really have to, as it will consume memory proportional to the length of the range | | `id( obj )` | `object_id( obj )` | | | `raise excetion` | `throw( exception )` | ## Basic String operations | *Python* | *Julia* | @@ -49,9 +50,11 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | f.close() | close( f ) | ## Exceptions (http://julia.readthedocs.org/en/latest/manual/control-flow/#exception-handling) | *Python* | *Julia* | |----------|---------| | `raise excetion` | `throw( exception )` | | RuntimeError( "msg" ) | (?) ErrorException( "msg" ) | -
cuckookernel revised this gist
Mar 31, 2014 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,5 +48,12 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | for line in f | for line in eachline( f ) | | f.close() | close( f ) | ## Exceptions | *Python* | *Julia* | |----------|---------| | RuntimeError( "msg" ) | (?) ErrorException( "msg" ) |
-
cuckookernel revised this gist
Mar 31, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | `"string %s interpolation %d" % ( str1, i1)` | `"string $str1 interpolation $i1 "` | You can interpolate arbitrary expressions by enclosing them in braces, as in `"${x+y}"` | | `xrange(10,4,-2`)` | `10:-2:4` | | | `range(10,4,-2)` | `[10:-2:4]` | Do this only if you really have to, as it will consume memory proportional to the length of the range | | `id( obj )` | `object_id( obj )` | | ## Basic String operations | *Python* | *Julia* | -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 6 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,11 +3,10 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr ## Some important differences * Arrays in Julia are indexed starting from 1. * In Julia classes (i.e. types) don't own methods. Methods are implementations of generic functions and are invoked in a "static style", i.e. instead of Python's str1.rstrip(), we will have rstrip( str1 ), instead of file1.close(), close( file1 ). ## Some important similarities. * ## Core | *Python* | *Julia* | *Comments* | @@ -27,10 +26,10 @@ A quick and dirty syntax translation / conversion reference guide to ease the tr | *Python* | *Julia* | | -------------------------|-----------| | `str1 + str2 + str2` | `string( str1, str2, str3 )` | | `len( str1 )` | `length( str1 )` | | `str1.rstrip()` | `rstrip( str1 )` | | `str1.startswith( x )` | ??? write your own such as the one in [pytojul.jl](https://gist.github.com/cuckookernel/9777067#file-pytojul-jl) | ## Regular expressions -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,12 @@ A quick and dirty syntax translation / conversion reference guide to ease the transition between Python and Julia. This is not meant as a reference to the language. For that you should [read the manual](http://julia.readthedocs.org/en/latest/manual/). ## Some important differences * Arrays in Julia are indexed starting from 1. * In Julia classes (i.e. types) don't own methods. Methods are implementations of generic functions and are invoked in a "static style", i.e. instead of Python's str1.rstrip(), we will have rstrip( str1 ), instead of file1.close(), close( file1 ). * ## Some important similarities. ## Core @@ -17,7 +21,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | `lambda x, y : y + x * 2` | `(x,y) -> y + x * 2` | | | `"string %s interpolation %d" % ( str1, i1)` | `"string $str1 interpolation $i1 "` | You can interpolate arbitrary expressions by enclosing them in braces, as in `"${x+y}"` | | `xrange(10,4,-2`)` | `10:-2:4` | | | `range(10,4,-2)` | `[10:-2:4]` | Do this only if you really have to, as it will consume memory proportional to the length of the range | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,8 @@ A quick and dirty syntax translation guide to ease the transition between Python | `elif` | `elseif` | | | `lambda x, y : y + x * 2` | `(x,y) -> y + x * 2` | | | `"string %s interpolation %d" % ( str1, i1)` | `"string $str1 interpolation $i1 "` | You can interpolate arbitrary expressions by enclosing them in braces, as in `"${x+y}"` | | `xrange(10,4,-2`)` | `10:-2:4` | | | `range(10,4,-2)``| `[10:-2:4]` | Do this only if you really have to | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,17 +6,17 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Core | *Python* | *Julia* | *Comments* | | -------------------------|---------|----------| | `True` | `true` | | | `False` | `false` | | | `None` | `nothing` | | | `type( obj )` | `typeof( obj )` | | | `{}` | `Dict{KeyType,ValueType}()` | | | `elif` | `elseif` | | | `lambda x, y : y + x * 2` | `(x,y) -> y + x * 2` | | | `"string %s interpolation %d" % ( str1, i1)` | `"string $str1 interpolation $i1 "` | You can interpolate arbitrary expressions by enclosing them in braces, as in `"${x+y}"` | | `xrange(10,4,-2) | 10:-2:4` | | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,17 +6,17 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Core | *Python* | *Julia* | * Comments* | | -------------------------|-----------| | `True` | `true` | | `False` | `false` | | `None` | `nothing` | | `type( obj )` | `typeof( obj )` | | `{}` | `Dict{KeyType,ValueType}()` | | `elif` | `elseif` | | `lambda x, y : y + x * 2` | `(x,y) -> y + x * 2` | | `"string %s interpolation %d" % ( str1, i1)` | `"string $str1 interpolation $i1 "` | You can interpolate arbitrary expressions by enclosing them in braces, as in `"${x+y}"` | | `xrange(10,4,-2) | 10:-2:4` | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ A quick and dirty syntax translation guide to ease the transition between Python and Julia. This is not meant as a reference to the language. For that you should [read the manual](http://julia.readthedocs.org/en/latest/manual/). ## Some important differences * Arrays in Julia are indexed starting from 1. @@ -16,8 +16,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | elif | elseif | | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> | | "string %s interpolation %d" % ( str1, i1) | "string $str1 interpolation $i1 " | | xrange(10,4,-2) | 10:-2:4 | ## Basic String operations @@ -26,6 +25,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | str1 + str2 | string( str1, str2 ) | | len( str1 ) | length( str1 ) | | str1.rstrip() | rstrip( str1 ) | | str1.startswith( x ) | ??? write your own such as the one in [pytojul.jl](https://gist.github.com/cuckookernel/9777067#file-pytojul-jl) | ## Regular expressions -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ module pytojul.jl export startswith function startswith( x::ASCIIString, y::ASCIIString ) # Disclaimer: This function is still buggy. Please help me find the bug... @@ -11,4 +15,6 @@ function startswith( x::ASCIIString, y::ASCIIString ) end return true end end end #module -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | elif | elseif | | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> | | "string %s interpolation %d" % ( str1, i1) | "string $str1 interpolation $i1 " | | str1.startswith( x ) | ??? write your own such as the one in [pytojul.jl](https://gist.github.com/cuckookernel/9777067#file-pytojul-jl) | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 2 changed files with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | elif | elseif | | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> | | "string %s interpolation %d" % ( str1, i1) | "string $str1 interpolation $i1 " | | str1.startswith( x ) | ??? write your own suc as the one in pytojul.jl | ## Basic String operations This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ function startswith( x::ASCIIString, y::ASCIIString ) # Disclaimer: This function is still buggy. Please help me find the bug... if length(y) > length(x) return false else -
cuckookernel revised this gist
Mar 26, 2014 . 2 changed files with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | {} | <code>Dict{KeyType,ValueType}() | | elif | elseif | | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> | | "string %s interpolation %d" % ( str1, i1) | "string $str1 interpolation $i1 " | ## Basic String operations This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function startswith( x::ASCIIString, y::ASCIIString ) if length(y) > length(x) return false else for i = 1 : length(y) if x[i] != y[i] return false end end return true end end -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,13 +8,13 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Core | *Python* | *Julia* | | -------------------------|-----------| | True | <code>true | | False | <code>false | | None | <code>nothing | | type( obj ) | <code>typeof( obj ) | | {} | <code>Dict{KeyType,ValueType}() | | elif | elseif | | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,11 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Core | *Python* | *Julia* | | -------------------------|-----------| | True | <code> true | | False | <code> false | | None | <code> nothing | | type( obj ) | <code> typeof( obj ) | | {} | <code> Dict{KeyType,ValueType}() | | elif | elseif | | lambda x, y : y + x * 2 | <code> (x,y) -> y + x * 2 </code> | -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | type( obj ) | typeof( obj ) | | {} | Dict{KeyType,ValueType}() | | elif | elseif | | lambda x, y : y + x * 2 | <code> (x,y) -> y + x * 2 </code> | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | type( obj ) | typeof( obj ) | | {} | Dict{KeyType,ValueType}() | | elif | elseif | | lambda x, y : y + x * 2 | (x,y) -> y + x * 2 | ## Basic String operations @@ -24,8 +24,6 @@ A quick and dirty syntax translation guide to ease the transition between Python | str1 + str2 | string( str1, str2 ) | | len( str1 ) | length( str1 ) | | str1.rstrip() | rstrip( str1 ) | ## Regular expressions -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,8 @@ A quick and dirty syntax translation guide to ease the transition between Python | str1 + str2 | string( str1, str2 ) | | len( str1 ) | length( str1 ) | | str1.rstrip() | rstrip( str1 ) | | lambda x, y : y + x * 2 | (x,y) -> y + x * 2 | ## Regular expressions -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Some important differences * Arrays in Julia are indexed starting from 1. * In Julia classes (i.e. types) don't own methods. Methods are implementations of generic functions and are invoked in a "static style", i.e. instead of Python's str1.rstrip(), we will have rstrip( str1 ), instead of file1.close(), close( file1 ). ## Core -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,7 @@ A quick and dirty syntax translation guide to ease the transition between Python ## Some important differences * Arrays in Julia are indexed starting from 1. * In Julia class (i.e. types) don't own methods. Methods are implementations of generic functions and are invoked in a "static style", i.e. instead of Python's str1.rstrip(), we will have rstrip( str1 ), instead of file1.close(), close( file1 ). ## Core @@ -24,7 +23,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | -------------------------|-----------| | str1 + str2 | string( str1, str2 ) | | len( str1 ) | length( str1 ) | | str1.rstrip() | rstrip( str1 ) | ## Regular expressions -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,5 +41,7 @@ A quick and dirty syntax translation guide to ease the transition between Python |----------|---------| | f = open( "file.txt" ) | f = open( "file.txt") | | for line in f | for line in eachline( f ) | | f.close() | close( f ) |
-
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,11 @@ A quick and dirty syntax translation guide to ease the transition between Python and Julia. ## Some important differences * Arrays in Julia are indexed starting from 1. ## Core | *Python* | *Julia* | | -------------------------|-----------| -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ A quick and dirty syntax translation guide to ease the transition between Python | None | nothing | | type( obj ) | typeof( obj ) | | {} | Dict{KeyType,ValueType}() | | elif | elseif | -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ A quick and dirty syntax translation guide to ease the transition between Python | False | false | | None | nothing | | type( obj ) | typeof( obj ) | | {} | Dict{KeyType,ValueType}() | ## Basic String operations -
cuckookernel revised this gist
Mar 26, 2014 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,14 @@ A quick and dirty syntax translation guide to ease the transition between Python and Julia. ## Core | *Python* | *Julia* | | -------------------------|-----------| | True | true | | False | false | | None | nothing | | type( obj ) | typeof( obj ) | ## Basic String operations | *Python* | *Julia* | -
cuckookernel created this gist
Mar 26, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ ## Basic String operations | *Python* | *Julia* | | -------------------------|-----------| | str1 + str2 | string( str1, str2 ) | | len( str1 ) | length( str1 ) | ## Regular expressions | *Python* | *Julia* | |----------|---------| | m = re.match( r"(\d+):(\d+)", mystr ) | m = match( r"(\d+):(\d+)", mystr ) | | <code>m is not None</code> | m != nothing | | arr = m.groups() | arr = m.captures | ## File processing | *Python* | *Julia* | |----------|---------| | f = open( "file.txt" ) | f = open( "file.txt") | | for line in f | for line in eachline( f ) |