1

I am trying to use a python function with named arguments from hy.

I'm using the NLTK library as well.

In python I would do something like this

from nltk.corpus import brown
brown.words(categories='news')

to get a list of words in the 'news' category.

I would like to do the same thing in hy. The only way I have figured out to do that is by finding out what order to pass the arguments in, and set all the ones I don't want to None

(import [nltk.corpus [brown]])
(.words brown None "news")

Is there another way to do this in hy that makes my intentions more clear? Imagine trying doing this with a function that has a lot of optional named arguments.

1 Answers1

2

Found the answer in the docs.

defn documentation

It would be done like this

(.words brown :categories "news")