What is the difference between y=list(x), & y=[x]?

#This code will not work:
map = {
None: [‘menu’],
‘menu’: [‘system’, ‘applications’, ‘settings’, ‘files’],
‘system’: ,
‘applications’: [‘eric6’, ‘inkscape’],
‘settings’: ,
‘files’: [‘search’, ‘access’],
‘eric6’: ,
‘inkscape’: ,
‘online’: [‘youtube’],
‘search’: ,
‘access’: ,
‘youtube’:
}

keys = list(map.keys()) # <---- change this line
for key in sorted(keys):
print(key)

bars = list(map.values()) # <---- and this line
values =
for bar in sorted(bars):
for value in sorted(bar):
values += [value]
for value in values:
print(value)

#--------------------------------------------------------------------------------
#This code will work:
map = {
None: [‘menu’],
‘menu’: [‘system’, ‘applications’, ‘settings’, ‘files’],
‘system’: ,
‘applications’: [‘eric6’, ‘inkscape’],
‘settings’: ,
‘files’: [‘search’, ‘access’],
‘eric6’: ,
‘inkscape’: ,
‘online’: [‘youtube’],
‘search’: ,
‘access’: ,
‘youtube’:
}

keys = [map.keys()] # <---- change this line
for key in sorted(keys):
print(key)

bars = [map.values()] # <---- and this line
values =
for bar in sorted(bars):
for value in sorted(bar):
values += [value]
for value in values:
print(value)
#--------------------------------------------------------------------------------

I don’t see the difference.

In short, is a literal declaration of a list which contains one
item, the object x. On the other hand, list(x) creates a list by
recasting the object x from whatever other type it was to a list
type. This is easiest to see in the REPL by using a string example,
since it’s treated as an iterable:

>>> ['foo']
['foo']
>>> list('foo')
['f', 'o', 'o']

As you’ll notice, in the first form, a list is created with one
element, the string type object ‘foo’. In the second form, on the
other hand, a list is created with each character of the string
‘foo’ as a separate item in the list.

In your more complex code sample, the type of object being recast is
of the dict_keys class, but the principle is the same. If you put a
dict_keys object in a literal list you have a list with one
element which is the dict_keys object. If you pass it to the list()
constructor built-in instead, you get a list with each element being
one of the iterable contents of the original dict_keys object,
rather than just the object itself.

Awsome!
Now I can go on forward.
Thanks

Thanks!
Python rocks!