Skip to content

Instantly share code, notes, and snippets.

@cuckookernel
Last active March 20, 2023 04:02
Show Gist options
  • Save cuckookernel/9777067 to your computer and use it in GitHub Desktop.
Save cuckookernel/9777067 to your computer and use it in GitHub Desktop.

Revisions

  1. cuckookernel revised this gist Apr 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pythontojulia.md
    Original 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 )` |
    ## Basic String operations
    | `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* |
    | -------------------------|-----------|
  2. cuckookernel revised this gist Mar 31, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pythontojulia.md
    Original 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` | |
  3. cuckookernel revised this gist Mar 31, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pythontojulia.md
    Original 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` | |
  4. cuckookernel revised this gist Mar 31, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions pythontojulia.md
    Original 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" ) |


  5. cuckookernel revised this gist Mar 31, 2014. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions pythontojulia.md
    Original 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" ) |




  6. cuckookernel revised this gist Mar 31, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pythontojulia.md
    Original 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* |
  7. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions pythontojulia.md
    Original 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 | 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) |
    | `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
  8. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions pythontojulia.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    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/).
    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 |
    | `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

  9. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pythontojulia.md
    Original 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` | |
    | `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

  10. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions pythontojulia.md
    Original 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` |
    | *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` |
    | `xrange(10,4,-2) | 10:-2:4` | |

    ## Basic String operations

  11. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions pythontojulia.md
    Original 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* |
    | *Python* | *Julia* | * Comments* |
    | -------------------------|-----------|
    | 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> |
    | "string %s interpolation %d" % ( str1, i1) | "string $str1 interpolation $i1 " |
    | xrange(10,4,-2) | 10:-2:4 |
    | `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

  12. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions pythontojulia.md
    Original 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.
    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 " |
    | str1.startswith( x ) | ??? write your own such as the one in [pytojul.jl](https://gist.github.com/cuckookernel/9777067#file-pytojul-jl) |

    | 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
  13. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion pytojul.jl
    Original 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

    end #module
  14. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pythontojulia.md
    Original 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 suc as the one in pytojul.jl |
    | 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
  15. cuckookernel revised this gist Mar 26, 2014. 2 changed files with 3 additions and 0 deletions.
    1 change: 1 addition & 0 deletions pythontojulia.md
    Original 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
    2 changes: 2 additions & 0 deletions pytojul.jl
    Original 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
  16. cuckookernel revised this gist Mar 26, 2014. 2 changed files with 13 additions and 0 deletions.
    1 change: 1 addition & 0 deletions pythontojulia.md
    Original 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
    12 changes: 12 additions & 0 deletions pytojul.jl
    Original 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
  17. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions pythontojulia.md
    Original 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}() |
    | 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> |
    | lambda x, y : y + x * 2 | <code>(x,y) -> y + x * 2</code> |


    ## Basic String operations
  18. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions pythontojulia.md
    Original 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 | true |
    | False | false |
    | None | nothing |
    | type( obj ) | typeof( obj ) |
    | {} | Dict{KeyType,ValueType}() |
    | 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> |

  19. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pythontojulia.md
    Original 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 |
    | lambda x, y : y + x * 2 | <code> (x,y) -> y + x * 2 </code> |


    ## Basic String operations
  20. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions pythontojulia.md
    Original 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 ) |
    | lambda x, y : y + x * 2 | (x,y) -> y + x * 2 |



    ## Regular expressions
  21. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pythontojulia.md
    Original 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
  22. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pythontojulia.md
    Original 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 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 ).
    * 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
  23. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions pythontojulia.md
    Original 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
  24. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pythontojulia.md
    Original 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 ) |



  25. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions pythontojulia.md
    Original 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* |
    | -------------------------|-----------|
  26. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pythontojulia.md
    Original 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 |



  27. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pythontojulia.md
    Original 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
  28. cuckookernel revised this gist Mar 26, 2014. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions pythontojulia.md
    Original 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* |
  29. cuckookernel created this gist Mar 26, 2014.
    25 changes: 25 additions & 0 deletions pythontojulia.md
    Original 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 ) |