Re: [Tutor] (regarding unorderable types

2017-08-04 Thread Howard Lawrence
Thank you for the clarification.
as a newbie at mailing list and coding
I try to be more specific,their is more to come

On Aug 3, 2017 10:09 PM, "Cameron Simpson"  wrote:

Hi, and welcome to the tutor list.

Please try to provide a useful subject line in future posts (not "help",
perhaps something like "I don't understand this TypeError message").

Anyway, to your question:

On 03Aug2017 13:27, Howard Lawrence <1019sh...@gmail.com> wrote:

> hi ! i am newbie to coding love it but need help with problems which i
> searched but poor results this is the error: typeError unorderable types:
> int()

Please always include the entire error message with a text cut/paste; it
usually contains lots of useful information.

The error above means that you have a "int" and a "str", and are trying to
compare them. That is not supported.

the code in short
>

Please always incode the full code, ideally something stripped down to the
smallest program you can run which still produces the error. Often problems
come from something which is omitted in a "from memory" description of the
code, rather than the raw code itself.

number=random.randint(1,20)
> guess=input()
> guess=int(guess)
> but when reach the line that says
> if guess
> i get the error ! help
>

As remarked, you can't compare an int and a str; it is not meaningful.

Your code above _should_ have an int in the value of "guess". However, I
suspect your code actually may look like this:

 number=random.randint(1,20)
 guess=input()
 guess_value=int(guess)
 if guess (formerly c...@zip.com.au)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] setup.py "script" vs "console_scripts" Was: if __name__=='main' vs entry points: What to teach new comers?

2017-08-04 Thread Thomas Güttler



Am 04.08.2017 um 02:50 schrieb Ben Finney:

Thomas Güttler  writes:


Why are there two ways: "script" vs "console_scripts entry-point"?


Because Distutils implements only ‘scripts’, and that's not capable
enough for what people need so Setuptools implements entry points.

In other words: One of them is in the standard library and does
something; the other is third-party and can do more.

That answers why there are two. But maybe you wanted to ask some
underlying question?


The underlaying question is: Imangine you are a newcomer. And there
are two more choices. You need a guide like 'if unsure do x'. With
other words: What is the sane default choice?

Chris wrote "Simple: `scripts` are legacy."

You say it is the standard, and console_scripts is from a third party.

For me "legacy" sound like "don't go this old way".

For me "third party" sounds like "don't go this way, stick to the standard".

I feel stupid since I have no clue.

Regards,
  Thomas Güttler

--
Thomas Guettler http://www.thomas-guettler.de/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] setup.py "script" vs "console_scripts" Was: if __name__=='main' vs entry points: What to teach new comers?

2017-08-04 Thread eryk sun
On Fri, Aug 4, 2017 at 10:15 AM, Thomas Güttler
 wrote:
> Am 04.08.2017 um 02:50 schrieb Ben Finney:
>
>> Because Distutils implements only ‘scripts’, and that's not capable
>> enough for what people need so Setuptools implements entry points.
>>
>> In other words: One of them is in the standard library and does
>> something; the other is third-party and can do more.
>>
>> That answers why there are two. But maybe you wanted to ask some
>> underlying question?
>
> The underlaying question is: Imangine you are a newcomer. And there
> are two more choices. You need a guide like 'if unsure do x'. With
> other words: What is the sane default choice?

A newcomer should simply check for __name__ == "__main__". Learning
about packaging comes later.

> Chris wrote "Simple: `scripts` are legacy."
>
> You say it is the standard, and console_scripts is from a third party.

console_scripts and gui_scripts are installed by setuptools and pip,
which are developed under the umbrella of the Python Packaging
Authority [1]. The standard library also has the ensurepip [2] module
to install pip and setuptools. As third-party packages go, they're as
close to being 'standard' as you can get.

> For me "legacy" sound like "don't go this old way".

Legacy scripts aren't automatically created as console or GUI
executables when installed on Windows. Often Windows users associate
.py scripts with an editor, in which case legacy scripts aren't
executable from PATH, i.e. they have to be run as `python
legacy_script.py`, for example.

[1]: https://www.pypa.io
[2]: https://docs.python.org/3/library/ensurepip
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] setup.py "script" vs "console_scripts" Was: if __name__=='main' vs entry points: What to teach new comers?

2017-08-04 Thread Chris Warrick
On 4 August 2017 at 12:15, Thomas Güttler  wrote:
> Chris wrote "Simple: `scripts` are legacy."
>
> You say it is the standard, and console_scripts is from a third party.
>
> For me "legacy" sound like "don't go this old way".
>
> For me "third party" sounds like "don't go this way, stick to the standard".
>
> I feel stupid since I have no clue.

The official docs recommend distutils:

https://docs.python.org/2/library/distutils.html

> Most Python users will not want to use this module directly, but instead use 
> the cross-version tools maintained by the Python Packaging Authority. In 
> particular, setuptools is an enhanced alternative to distutils that provides:
> [snip]
> * the ability to declare project “entry points”, which can be used as the 
> basis for application plugin systems
> * the ability to automatically generate Windows command line executables at 
> installation time rather than needing to prebuild them

And, as eryk sun mentioned, recent Python 2.7 and 3.4 versions ship
setuptools and pip, via the ensurepip module.

-- 
Chris Warrick 
PGP: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unorderable types

2017-08-04 Thread Cameron Simpson

[ Back onto the tutor list. - Cameron ]

On 04Aug2017 09:12, Howard Lawrence <1019sh...@gmail.com> wrote:

This is the code from tutorial


Thank you.


import random
guessesTaken =0

print ('hello what is your name')
myName =input ()

number = random.randint(1,20)
print ('well, ' + myName + ', I am thinking of a number between 1 and 20')

while guessesTaken < 6:
   print ('take a guess')
   guess=input ()
   guess_value =int (guess)


Spooky :-) So you have "guess" containing the string from input(), and 
"guess_value" has the int.



   guessesTaken = guessesTaken +1

   If guess_value < number: # this is it
   print('your guess is too low')


Strange, this should work. Btw, "If" should be lower case "if".

[...snip...]

# I changed all the "guess" to "guess_value" got the same result!

This is it: traceback ( most recent call last):
File "C:/User/Shaun/guessGame.py", line 19, in 
If guess_value < number:
typeError: unorderable types:int() < str ()


Interesting. Can you put this:

 print("type(guess_value) =", type(guess_value))
 print("type(number) =", type(number))

above that line and run it again? Because I just ran your code here and it 
worked for me.



Hope this can help you and mostly me
I don't wanna give up but help is scarce from my location


That's fine. The list is for help.

Cheers,
Cameron Simpson 
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unorderable types

2017-08-04 Thread boB Stepp
On Fri, Aug 4, 2017 at 8:44 PM, Cameron Simpson  wrote:
> [ Back onto the tutor list. - Cameron ]
>
> On 04Aug2017 09:12, Howard Lawrence <1019sh...@gmail.com> wrote:
>>
>> This is the code from tutorial
>
>
> Thank you.
>
>> import random
>> guessesTaken =0
>>
>> print ('hello what is your name')
>> myName =input ()
>>
>> number = random.randint(1,20)
>> print ('well, ' + myName + ', I am thinking of a number between 1 and 20')
>>
>> while guessesTaken < 6:
>>print ('take a guess')
>>guess=input ()
>>guess_value =int (guess)
>
>
> Spooky :-) So you have "guess" containing the string from input(), and
> "guess_value" has the int.
>
>>guessesTaken = guessesTaken +1
>>
>>If guess_value < number: # this is it
>>print('your guess is too low')
>
>
> Strange, this should work. Btw, "If" should be lower case "if".
>
> [...snip...]
>>
>> # I changed all the "guess" to "guess_value" got the same result!
>>
>> This is it: traceback ( most recent call last):
>> File "C:/User/Shaun/guessGame.py", line 19, in 
>> If guess_value < number:
>> typeError: unorderable types:int() < str ()

When I attempted to recreate his error message with the original code
snippets he sent, I got something a bit different:


py3: guess = input()
2
py3: guess < number
Traceback (most recent call last):
  File "", line 1, in 
TypeError: '<' not supported between instances of 'str' and 'int'


I am running Python 3.6.1 on Windows 7 64-bit.  Off-list Howard told
me that he is running Python 3.5 on Windows 7, using PyCharm as his
editor.

Did the text of this error message change between Python 3.5 and 3.6?
Could how he is using PyCharm -- a full-fledged Python IDE -- be
causing this problem?  I once tried out PyCharm a few years back, but
cannot recall if one has to save first before re-running the code from
within PyCharm in order for it to see the most recent version or not.


-- 
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] setup.py "script" vs "console_scripts" Was: if __name__=='main' vs entry points: What to teach new comers?

2017-08-04 Thread Ben Finney
Thomas Güttler  writes:

> The underlaying question is: Imangine you are a newcomer.

A newcomer is in a tough position when it comes to packaging and
distributing Python code, especially the command-line programs.

There has been significant progress on this in recent years. The
Setuptools third-party library is a lot saner, the inclusion of ‘pip’ in
standard installs makes it much broader in scope.

But *not* in the standard library today, it's true.

> You need a guide like 'if unsure do x'. With other words: What is the
> sane default choice?

There isn't a good answer to that question, today.

The best answer today is: Read the guides from the Python Packaging
Authority, and stay abreast of developments because this continues to
change.

Maybe eventually the ongoing work of the PyPA will be settled enough
that it can update the standard library Distutils. But not today.

-- 
 \  “Nothing is more sacred than the facts.” —Sam Harris, _The End |
  `\   of Faith_, 2004 |
_o__)  |
Ben Finney

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unorderable types

2017-08-04 Thread Cameron Simpson

On 04Aug2017 22:00, boB Stepp  wrote:

When I attempted to recreate his error message with the original code
snippets he sent, I got something a bit different:


py3: guess = input()
2
py3: guess < number
Traceback (most recent call last):
 File "", line 1, in 
TypeError: '<' not supported between instances of 'str' and 'int'



I don't know about the text of the message, but his original snippets included 
a:


 guess = int(guess)

between those 2 lines.

Anyway, we have his current code, which i can't made produce the error.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor