Forwarding to the list...
From: RRRoy BBBean
Organisation: DDDead MMMail
To: Alan Gauld , tutor@python.org
On Sun, 2017-11-12 at 23:06 +, Alan Gauld via Tutor wrote:
> On 12/11/17 15:54, 劉權陞 wrote:
...
> Can you tell us what language this is?
> Or better still
Sorry 劉權陞 <01patrick...@gmail.com>, but this is an English-language
mailing list. I do not understand what question you are asking.
On Sun, Nov 12, 2017 at 11:54:52PM +0800, 劉權陞 wrote:
> 我在使用closure 時,遇到了一些問題。
> 例如一個簡單的例子,
>
> def f1(a):
> def f2(b):
> return a+b
> return f2
>
On 12/11/17 15:54, 劉權陞 wrote:
> 我在使用closure 時,遇到了一些問題。
> 例如一個簡單的例子,
>
> def f1(a):
> def f2(b):
> return a+b
> return f2
>
> f1=f1(10)
>
> 這時f1會發生衝突 ,這是正常的嗎?
Can you tell us what language this is?
Or better still post an English translation?
That's what most of us speak on this
我在使用closure 時,遇到了一些問題。
例如一個簡單的例子,
def f1(a):
def f2(b):
return a+b
return f2
f1=f1(10)
這時f1會發生衝突 ,這是正常的嗎?
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tu
On Sun, Nov 12, 2017 at 02:37:06AM -0800, anish singh wrote:
> Can someone explain me this code to create a trie
> from words?
Not really. What makes this a trie? Where did you get this code from?
> import collections
> words = ["bad", "sad", "abyss"]
>
> Trie = lambda: collections.defaultdict(
anish singh wrote:
> Can someone explain me this code to create a trie
> from words?
>
> import collections
> words = ["bad", "sad", "abyss"]
>
> Trie = lambda: collections.defaultdict(Trie)
> trie = Trie()
> END = True
>
> for i, word in enumerate(words):
> reduce(dict.__getitem__, word, t
Can someone explain me this code to create a trie
from words?
import collections
words = ["bad", "sad", "abyss"]
Trie = lambda: collections.defaultdict(Trie)
trie = Trie()
END = True
for i, word in enumerate(words):
reduce(dict.__getitem__, word, trie)[END] = i
print(trie.values())
I am no