[issue36574] Error with self in python

2019-04-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The error message is correct. The bug is in your code. Also, the code you tell 
us that you are running is not the same as the code you are actually running.

You should not call __init__ directly as you do:

# this is wrong
Person.__init__("Some","One",21,"American")

Do this instead:

Person("Some","One",21,"American")


Closing this as it is not a bug in Python, it is a bug in your code.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36574] Error with self in python

2019-04-09 Thread Tommy

Joan Tomas (Tommy) Pujol Muñoz  added the comment:

The python file.
It works in Linux (Ubuntu) but not in Windows; at least for me.
The output error is : 
Traceback (most recent call last):
  File "pySelf.py", line 8, in 
print(Person.__init__("Some","One",21,"American"))
TypeError: __init__() missing 1 required positional argument: 'nationality'

--
Added file: https://bugs.python.org/file48257/pySelf.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36574] Error with self in python

2019-04-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The file you have attached doesn't seem to be a Python script, it seems to be 
some sort of Windows batch file or similar.

Please supply an actual Python file. (Hint: remove the "del code.py" line from 
your batch file.) Also, copy and paste the traceback you receive, as text (not 
a screenshot).

It may help if you read this for ways to submit good bug reports:

http://www.sscce.org/


Thank you.

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36574] Error with self in python

2019-04-09 Thread Tommy

New submission from Joan Tomas (Tommy) Pujol Muñoz :

I try to use self with the __init__ function in a class, but when I enter the 
other values e.g. def __init__(self, name): self.name = name /// and when I 
call the class with a name it says that it need another value because it uses 
self an another value. It happened when I was using Windows 10, but normally I 
use Linux.

--
files: pySelf.cmd
messages: 339746
nosy: tommypm
priority: normal
severity: normal
status: open
title: Error with self in python
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48252/pySelf.cmd

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com