Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error TypeError: unsupported operand type(s) for &: 'list' and 'list' #13

Open
sbansal6 opened this issue Feb 13, 2017 · 4 comments

Comments

@sbansal6
Copy link

Running the example code:-

import fang

di = fang.Di(namespace='.com.example.myproject')

@di.dependsOn('multiplier')
def multiply(n):
'''Multiply the given number n by some configured multiplier.'''
multiplier = di.resolver.unpack(multiply)
return multiplier * n

providers = fang.ResourceProviderRegister(namespace='.com.example.myproject')

@providers.register('multiplier')
def give_multiplier():
'''Give a multiplier of 2.'''
return 2

def main():
# Here at our program entry-point, we configure what set of providers
# will be used to meet our dependencies
di.providers.load(providers)
# Prints 10
print(multiply(5))

if name == 'main':
main()

@ncraike
Copy link
Owner

ncraike commented Feb 18, 2017

Hi @sbansal6.

Sorry for taking a bit to reply on this. I had a busy few days, and this is a hobby project for me.

I'm having trouble reproducing the TypeError you gave above.

How are you running the code above? Did you copy and paste it from the GitHub page? And how have you installed Fang? Do you install Fang with pip install fang? Are you running Python 3.3 or later?

The repository contains a copy of the example code in examples/introduction.py, so if you have cloned the repository and have Fang installed, the easiest way to test that example is by running python3 examples/introduction.py.

If I run that in my terminal, I get output like:

$ python3 examples/introduction.py
10

The example code just outputs 10.

I'm happy to help you debug the problem further. Would you mind posting what operating system you're using (Windows, macOS, Linux)? And the output of python3 --version and pip show fang?

@ncraike
Copy link
Owner

ncraike commented Feb 20, 2017

@sbansal6 Are you running this with Python 2?

@sbansal6
Copy link
Author

sbansal6 commented Feb 20, 2017 via email

@ncraike
Copy link
Owner

ncraike commented Feb 20, 2017

Okay. Fang actually requires Python 3.4 or later.

I expected that the packaging settings I have in setup.py would prevent you installing Fang on Python 2.7, but maybe that is not the case.

How did you install Fang on your system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants