Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: TypeError: 'type' object is not subscriptable
Post: TypeError: 'type' object is not subscriptable

Hi, I'm fairly new to Python and I'm getting this error and to be honest, I have no clue why. I get it when running a pytest. The full stacktrace is: Quote:emusim/pytest/test_central_bank.py:1: in &...
Stef General Coding Help 1 4,533 Aug-28-2020, 01:31 PM
    Thread: Object already contains values when created
Post: RE: Object already contains values when created

@deanhystad Thank you so much! I'm coming from Java and am fairly new to Python so I'm carrying some old habits with me. I totally was unaware of how class variables and instance variables were treat...
Stef General Coding Help 4 2,392 Aug-20-2020, 09:42 AM
    Thread: Object already contains values when created
Post: RE: Object already contains values when created

Indeed, I forgot to copy the validate() and clear() methods of BalanceSheet. Here they are: def clear(self): self.assets.clear() self.liabilities.clear() def validate(self) -...
Stef General Coding Help 4 2,392 Aug-19-2020, 02:22 PM
    Thread: Object already contains values when created
Post: Object already contains values when created

I am running some unit tests using pytest in PyCharm and am running into a, for me, weird problem. class BalanceSheet(): """Balance sheet""" __assets: Dict[str, float] = {} __liabilities...
Stef General Coding Help 4 2,392 Aug-19-2020, 12:53 PM
    Thread: Looking for usable voting software using Shultz STV
Post: Looking for usable voting software using Shultz ST...

Hi, I want to do research on the influence of voting systems on election results. For that I would like to compare ranked voting with the Shulze STV methodology against the currently used 1 vote syst...
Stef Bar 1 1,629 Oct-23-2019, 09:41 AM
    Thread: Bug that crashes the Python interpreter 3.7 on Mac OS X
Post: Bug that crashes the Python interpreter 3.7 on Mac...

I'm pretty new to Python and am currently exploring Flask. I wanted to subclass one the Field classes to create a percentage field but when I add it to a form, it crashes my interpreter. Here's the co...
Stef General Coding Help 1 3,696 Feb-13-2019, 11:35 AM
    Thread: Weird scoping error
Post: RE: Weird scoping error

Thanks for the answers. It led to actually figuring out what was going on. Somewhere in the code that I had omitted from the post I accidentally made an assignment to bank_spending instead of to bank_...
Stef General Coding Help 3 2,875 Jan-20-2019, 04:36 PM
    Thread: Weird scoping error
Post: Weird scoping error

I bumped into this weird scoping error and I have no clue what's going on. #module main FIXED = 0 # banks spend a fixed amount into the economy PROFIT_PERCENTAGE = 1 # banks spend a ...
Stef General Coding Help 3 2,875 Jan-20-2019, 04:00 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020