`Any[]` constructs a list instance. The proper type signature is
`::Array{Any,1}` (or if you don't absolutely need it, you can leave the
member signature out of the type declaration)

On Tue, May 24, 2016 at 1:16 PM, Andreas Lobinger <[email protected]>
wrote:

> I tend to agree with you, however...
>
> julia> d = Any[]
> 0-element Array{Any,1}
>
> julia> type d1
>        name::AbstractString
>        content::Any[]
>        end
> ERROR: TypeError: d1: in type definition, expected Type{T}, got Array{Any,
> 1}
>
>
>
>
>
> On Tuesday, May 24, 2016 at 7:11:50 PM UTC+2, Stefan Karpinski wrote:
>>
>> Since Julia 0.4 [] is what you're looking for.
>>
>> On Tue, May 24, 2016 at 1:06 PM, Andreas Lobinger <[email protected]>
>> wrote:
>>
>>> Hello colleagues,
>>>
>>> it really feels strange to ask this, but what is the julia equivalent of
>>> python's list?
>>>
>>> So.
>>>
>>>
>>>    1. can by initialised empty
>>>    2. subject of append and extend
>>>    3. accepting Any entry
>>>    4. foolproof usage in type definition... (my real problem seems to
>>>    be here)
>>>
>>>
>>> Wishing a happy day,
>>>
>>>         Andreas
>>>
>>
>>

Reply via email to