Questions tagged [python-3.7]

Version of the Python programming language released in June 27, 2018. For issues that are specific to Python 3.7. Use the more generic [python] and [python-3.x] tags where possible.

Python 3.7 was released on June 27, 2018 (PEP 537).


Use this tag if your question is specifically related to Python 3.7. Otherwise, use the following guidelines to determine which tag(s) you should add to your question:

  • If your question applies to Python in general, use only the tag.
  • If your question applies to Python 3.x but not to Python 2.x, add the tag .
  • If you aren't sure, tag your question with and mention which version you're using in the post.

References

4167 questions
443
votes
4 answers

What are data classes and how are they different from common classes?

With PEP 557 data classes are introduced into python standard library. They make use of the @dataclass decorator and they are supposed to be "mutable namedtuples with default" but I'm not really sure I understand what this actually means and how…
kingJulian
  • 5,601
  • 5
  • 17
  • 30
274
votes
16 answers

Class inheritance in Python 3.7 dataclasses

I'm currently trying my hands on the new dataclass constructions introduced in Python 3.7. I am currently stuck on trying to do some inheritance of a parent class. It looks like the order of the arguments are botched by my current approach such that…
Mysterio
  • 2,878
  • 2
  • 15
  • 21
232
votes
7 answers

Data Classes vs typing.NamedTuple primary use cases

Long story short PEP-557 introduced data classes into Python standard library, that basically can fill the same role as collections.namedtuple and typing.NamedTuple. And now I'm wondering how to separate the use cases in which namedtuple is still a…
Oleh Rybalchenko
  • 6,998
  • 3
  • 22
  • 36
222
votes
19 answers

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

Importing from pyxdameraulevenshtein gives the following error, I have pyxdameraulevenshtein==1.5.3 pandas==1.1.4 scikit-learn==0.20.2. Numpy is 1.16.1. Works well in Python 3.6, Issue in Python 3.7. Has anyone been facing similar issues with…
Sachit Jani
  • 2,321
  • 2
  • 4
  • 5
129
votes
1 answer

Will OrderedDict become redundant in Python 3.7?

From the Python 3.7 changelog: the insertion-order preservation nature of dict objects has been declared to be an official part of the Python language spec. Would this mean that OrderedDict will become redundant? The only use I can think of it…
James Hiew
  • 6,040
  • 5
  • 27
  • 41
102
votes
6 answers

update to python 3.7 using anaconda

Python 3.7 alpha version is out, but I haven't been able to find any post on how to update to python 3.7 using Anaconda - maybe they will wait for the official release? Any suggestions?
Dnaiel
  • 7,622
  • 23
  • 67
  • 126
84
votes
18 answers

Dataclasses and property decorator

I've been reading up on Python 3.7's dataclass as an alternative to namedtuples (what I typically use when having to group data in a structure). I was wondering if dataclass is compatible with the property decorator to define getter and setter…
GertVdE
  • 1,153
  • 1
  • 7
  • 12
81
votes
3 answers

How can I get Python 3.7 new dataclass field types?

Python 3.7 introduces new feature called data classes. from dataclasses import dataclass @dataclass class MyClass: id: int = 0 name: str = '' When using type hints (annotation) in function parameters, you can easily get annotated types…
Kamyar
  • 2,494
  • 2
  • 22
  • 33
81
votes
7 answers

"RuntimeError: generator raised StopIteration" every time I try to run app

I am trying to run this code in Python 3.7: import web urls = ('/', 'index') if __name__ == "__main__": app = web.application(urls, globals()) app.run() But it gives me this error everytime: C:\Users\aidke\Desktop>python app.py Traceback…
no4syn
  • 813
  • 1
  • 6
  • 4
77
votes
10 answers

pip no longer working after update error 'module' object is not callable

After a pip update, pip has stopped working completely. Z:\>pip install matplotlib Traceback (most recent call last): File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "c:\program…
Agustin
  • 1,458
  • 1
  • 13
  • 30
76
votes
3 answers

Installing Python3.6 alongside Python3.7 on Mac

I'm trying to install tensorflow onto a Mac with Python3.7. However, I'm getting the error: $ pip3 -v install tensorflow ... Skipping link…
Sam
  • 2,172
  • 3
  • 24
  • 43
71
votes
1 answer

AttributeError: type object 'Callable' has no attribute '_abc_registry'

When I open my jupyter notebook I get errors. I use google for help, but I can't find an answer. I'm on macOS mojave and using python 3.7.2.I reinstalled my Jupiter notebook but no change. When I input jupyter notebook. It show me these Last login:…
朱嘉宇
  • 711
  • 1
  • 5
  • 5
63
votes
3 answers

How do I document a constructor for a class using Python dataclasses?

I have some existing Python 3.6 code that I'd like to move to Python 3.7 dataclasses. I have __init__ methods with nice docstring documentation, specifying the attributes the constructors take and their types. However, if I change these classes to…
anahata
  • 826
  • 1
  • 7
  • 14
62
votes
2 answers

How to fix " AttributeError at /api/doc 'AutoSchema' object has no attribute 'get_link' " error in Django

We are practicing an example of REST API on the Internet. However, the following error occurred. I tried a way in this link, but the situation hasn't changed. why swagger raises unclear error - Django from django.contrib import admin from…
Tim
  • 637
  • 1
  • 5
  • 9
57
votes
2 answers

Python 3.7 on Ubuntu 20.04

I am preparing a docker image for Ubuntu 20.04 and due to TensorFlow 2.0 requirement, I need Python 3.7. TensorFlow runs on Python 3.5 to 3.7. Running apt install python3 installs Python 3.8 by default and that breaks my TensorFlow installation. Is…
Kunal Shah
  • 1,011
  • 1
  • 8
  • 13
1
2 3
99 100