a écrit dans le message de
news:52f7516c-8601-4252-ab16-bc30c59c8...@googlegroups.com...
Hi,
there may be a serious error in python's int() function:
print int(float(2.8/0.1))
yields
27
instead of 28!!
I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
Is that known?
Best,
Marti
Ben Finney wrote:
I need a solution that is specific to the
Python program: it should only affect this program, and should not need
anything special done to the terminal when invoking the program.
You might be able to do something with the termios module
to put the tty driver into the appropria
Dan Sommers writes:
> On Thu, 14 Apr 2016 13:25:14 +1000, Ben Finney wrote:
>
> > How can my Python program convert the user's keyboard input to upper
> > case, as though the user has CAPS LOCK enabled?
>
> I don't know which OS you're using, but if I run "stty olcuc" in my
> Linux shell, then th
On Thu, 14 Apr 2016 13:25:14 +1000, Ben Finney wrote:
> How can my Python program convert the user's keyboard input to upper
> case, as though the user has CAPS LOCK enabled?
I don't know which OS you're using, but if I run "stty olcuc" in my
Linux shell, then the input driver does that for me.
How can my Python program convert the user's keyboard input to upper
case, as though the user has CAPS LOCK enabled?
I want to emulate a program running on a computer which doesn't have any
lower-case letters (i.e. a character set more limited than ASCII).
The text input, typed interactively by t
Hi all,
I'm looking for feedback on the below vote weighting algorithm which
includes sample input. This is written in Python3.
def weight(votes):
"""
Takes a list of tuples in the form of '(vote %, weight)' where vote %
is the
rating that a user gave and weight is the number of votes
On Wednesday, April 13, 2016 at 10:30:07 PM UTC+5:30, Peter Otten wrote:
> alister wrote:
>
> > On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote:
> >
> >> I have a doubt regarding a problem.
> >>
> > No, you have a question doubt means you don't believe something
> > (sorry I know this is no
Às 21:10 de 13-04-2016, Paulo da Silva escreveu:
> Hi all.
...
> [6 rows x 4 columns]
>
>> dft=pd.DataFrame([[1,2,3,4]],
> index=[datetime.date(2016,1,12)],columns=df.columns)
>
>> dft
> A B C D
> 2016-01-12 1 2 3 4
>
> [1 rows x 4 columns]
>
>> pd.concat([df,dft])
> Out[71]
On 13-4-2016 10:41, jkn wrote:
> Hi Irmen
>
> On Wednesday, April 13, 2016 at 12:22:25 AM UTC+1, Irmen de Jong wrote:
>> It seems that Python is fast enough [1] to create a real time FM music
>> synthesizer
>> (think Yamaha DX-7). I made one that you can see here:
>> https://github.com/irmen/sy
On 04/13/2016 07:21 AM, Ethan Furman wrote:
On 04/13/2016 07:07 AM, Marko Rauhamaa wrote:
class Color(enum.Enum):
red
blue
green
This last one is to the point but raises a NameError.
Using the aenum library that last one is possible. It also has
NamedConstan
Hi all.
I am learning pandas DataFrame and I want to add (eventually replace by
index) some rows.
For adding here is what I tried:
>df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))
>df
A B C D
2013-01-01 -0.111621 1.126761 -2.4
On 2016-04-13, Stephen Hansen wrote:
> On Tue, Apr 12, 2016, at 08:36 PM, kamaraju kusumanchi wrote:
>> Is there a way to get hourly weather forecast data (temperature,
>> chance of precipitation) from the command line in Debian Linux?
>
> Personally, the last time I wanted to do something like th
Robin Becker wrote:
> Does anyone know if sum does anything special to try and improve accuracy?
> My simple tests seem to show it is exactly equivalent to a for loop
> summation.
If you are worried about accuracy and your values are floating point numbers
use math.fsum():
"""
fsum(...)
fsu
Robin Becker writes:
> Does anyone know if sum does anything special to try and improve
> accuracy? My simple tests seem to show it is exactly equivalent to a
> for loop summation.
You want math.fsum.
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Apr 13, 2016, at 12:51, Robin Becker wrote:
> Does anyone know if sum does anything special to try and improve
> accuracy? My
> simple tests seem to show it is exactly equivalent to a for loop
> summation.
No, it doesn't. Sum works on any type that can be added (except
strings), it can't
alister wrote:
> On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote:
>
>> I have a doubt regarding a problem.
>>
> No, you have a question doubt means you don't believe something
> (sorry I know this is not an English language lesson)
"doubt" is commonly used that way in Indian English, see
Does anyone know if sum does anything special to try and improve accuracy? My
simple tests seem to show it is exactly equivalent to a for loop summation.
--
Robin Becker
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Apr 13, 2016 at 10:15 AM, alister wrote:
> On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote:
>
>> Hi all,
>>
>> I have a doubt regarding a problem.
>>
> No, you have a question doubt means you don't believe something
> (sorry I know this is not an English language lesson)
No, this is
On Wed, 13 Apr 2016 06:18:22 -0700, durgadevi1 wrote:
> Hi all,
>
> I have a doubt regarding a problem.
>
No, you have a question doubt means you don't believe something
(sorry I know this is not an English language lesson)
> First, I am required to read a given file.
>
>
> The output from t
salma ammar wrote:
> Hi,
>
> I am about to run this code using python 2.7. But when executing this code,
> an error appears (see attachement): IdentationError; unexpected indent
>
> What should I rectify to correct this error please?
>
>
> *import sys*
> *sys.path.append('C:/Users/user/src/sumo-0.
On Wed, Apr 13, 2016 at 9:53 AM, salma ammar wrote:
> Hi,
>
> I am about to run this code using python 2.7. But when executing this code,
> an error appears (see attachement): IdentationError; unexpected indent
>
> What should I rectify to correct this error please?
First of all, please post your
Hi, Salma,
On Wed, Apr 13, 2016 at 11:53 AM, salma ammar wrote:
> Hi,
>
> I am about to run this code using python 2.7. But when executing this code,
> an error appears (see attachement): IdentationError; unexpected indent
>
> What should I rectify to correct this error please?
>
>
> *import sys*
On Wed, 13 Apr 2016 16:53:09 +0100, salma ammar wrote:
> Hi,
>
> I am about to run this code using python 2.7. But when executing this
> code,
> an error appears (see attachement): IdentationError; unexpected indent
>
> What should I rectify to correct this error please?
>
>
> *import sys*
> *
Hi,
I am about to run this code using python 2.7. But when executing this code,
an error appears (see attachement): IdentationError; unexpected indent
What should I rectify to correct this error please?
*import sys*
*sys.path.append('C:/Users/user/src/sumo-0.22.0/tools')*
*import sumolib*
*net
On Wed, Apr 13, 2016, at 06:51 AM, durgadevi1 wrote:
> I would like to check with you whether using binascii.hexlify() to
> convert the series of bytes into alphabets and integers is correct.
To be clear, they already are integers.The \x notation is how you
naively represent a byte out of the prin
On Wed, Apr 13, 2016 at 8:27 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> Let's just guess that you want to xor with the byte value 0xAA. We can
>> do that fairly simply, using integer operations.
>>
> data = b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\\'
> bytes(b ^ 0xAA for b in data)
>>
On 12 April 2016 at 11:48, Sayth Renshaw wrote:
> Hi
>
> Looking at the wiki list of build tools
> https://wiki.python.org/moin/ConfigurationAndBuildTools
>
> Has anyone much experience in build tools as i have no preference or
> experience to lean on.
>
> Off descriptions only i would choose inv
On Wed, Apr 13, 2016 at 11:51 PM, durgadevi1
wrote:
> Ok thank you ChrisA. :)
>
> I would like to check with you whether using binascii.hexlify() to convert
> the series of bytes into alphabets and integers is correct.
It converts the bytes (which are small integers) into the hexadecimal
represe
Chris Angelico :
> Let's just guess that you want to xor with the byte value 0xAA. We can
> do that fairly simply, using integer operations.
>
data = b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\\'
bytes(b ^ 0xAA for b in data)
> b'\x8e\x85\x85\xfd\x95j(\x93\x08\x13\xb9&\x7f\xd1\xf6'
>
> Well,
On 04/13/2016 07:07 AM, Marko Rauhamaa wrote:
class Color(enum.Enum):
red
blue
green
This last one is to the point but raises a NameError.
Using the aenum library that last one is possible. It also has
NamedConstant and a metaclass-derived NamedTuple!
--
On Wed, Apr 13, 2016 at 7:50 AM, Grant Edwards
wrote:
> FWIW, as an old Pascal programmer, I too would have been surprised
> that an "enum" is not ordinal and doesn't support a next/prev and
> iteration.
They do support iteration, but it's by order of declaration, not by value.
--
https://mail.p
Grant Edwards :
> On 2016-04-13, Michael Selik wrote:
>> An Enum corresponds to "nominal" data that is coded as a number
>> simply for storage rather than meaning.
>
> FWIW, as an old Pascal programmer, I too would have been surprised
> that an "enum" is not ordinal and doesn't support a next/pre
On Wednesday, April 13, 2016 at 9:29:45 PM UTC+8, Chris Angelico wrote:
> On Wed, Apr 13, 2016 at 11:18 PM, durgadevi1
> wrote:
> >
> > The output from the file is given below:
> >
> > b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\'
> >
> >
> > I used the type() to identify the class and its a byte class.
On 2016-04-13, Michael Selik wrote:
> On Wed, Apr 13, 2016, 12:14 PM Antoon Pardon
> wrote:
>
>> I have been looking at the enum documentation and it seems enums
>> are missing two features I rather find important.
>>
>> 1) Given an Enum value, someway to get the next/previous
>>one
>>
>> 2)
On Wed, Apr 13, 2016 at 11:18 PM, durgadevi1
wrote:
>
> The output from the file is given below:
>
> b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\'
>
>
> I used the type() to identify the class and its a byte class.
>
> I saw many \x and thought it might be hex.
>
>
> So, I used binascii.hexlify() and go
Hi all,
I have a doubt regarding a problem.
First, I am required to read a given file.
The output from the file is given below:
b'$//W?\xc0\x829\xa2\xb9\x13\x8c\xd5{\'
I used the type() to identify the class and its a byte class.
I saw many \x and thought it might be hex.
So, I used bina
On Wednesday, April 13, 2016 at 5:39:13 PM UTC+5:30, Michael Selik wrote:
> On Wed, Apr 13, 2016, 12:14 PM Antoon Pardon
> wrote:
>
> > I have been looking at the enum documentation and it
> > seems enums are missing two features I rather find
> > important.
> >
> > 1) Given an Enum value, someway
On Wed, Apr 13, 2016, 12:14 PM Antoon Pardon
wrote:
> I have been looking at the enum documentation and it
> seems enums are missing two features I rather find
> important.
>
> 1) Given an Enum value, someway to get the next/previous
>one
>
> 2) Given two Enum values, iterate over the values
On 04/13/2016 12:12 PM, Antoon Pardon wrote:
I have been looking at the enum documentation and it
seems enums are missing two features I rather find
important.
1) Given an Enum value, someway to get the next/previous
one
2) Given two Enum values, iterate over the values between
them.
D
martin.spic...@gmail.com wrote:
print int(float(2.8/0.1))
yields
27
instead of 28!!
This is a consequence of the fact that the machine does
floating point arithmetic in binary, not decimal.
0.1 is not exactly representable as a binary floating
point number, and the result of the division co
Rustom Mody :
> Given the eg in the docs:
> from enum import Enum
> class Color(Enum):
> red = 1
> blue = 2
> green = 3
>
Color(Color.red.value+1)
>
But:
>>> class Color(enum.Enum):
... red = 0xff
... green = 0x00ff00
... blue = 0xff
...
>>> Colo
On Wednesday, April 13, 2016 at 3:43:41 PM UTC+5:30, Antoon Pardon wrote:
> I have been looking at the enum documentation and it
> seems enums are missing two features I rather find
> important.
>
> 1) Given an Enum value, someway to get the next/previous
>one
>
> 2) Given two Enum values, it
I have been looking at the enum documentation and it
seems enums are missing two features I rather find
important.
1) Given an Enum value, someway to get the next/previous
one
2) Given two Enum values, iterate over the values between
them.
Did I miss those in the documentation or are they
Hi Irmen
On Wednesday, April 13, 2016 at 12:22:25 AM UTC+1, Irmen de Jong wrote:
> It seems that Python is fast enough [1] to create a real time FM music
> synthesizer
> (think Yamaha DX-7). I made one that you can see here:
> https://github.com/irmen/synthesizer
>
> The synthesizer can create
On 13/04/2016 03:57, Jason Honeycutt wrote:
> Hello,
>
> I am providing feedback as to why I just uninstalled Python. I could not
> use pip. My command line would not recognize pip.exe as a file, even though
> I could see the file listed when I type "dir" in the Scripts folder.
>
> I tried to rep
On 13/04/2016 08:41, martin.spic...@gmail.com wrote:
> Hi,
>
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
>
> I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
>
> Is that known?
This arises because f
martin.spic...@gmail.com writes:
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
That's how floating-point arithmetic works: look at the result of
2.8/0.1 to see why int() is correct.
> Is that known?
Yes, it is known, and correct since you use "float". See
http://floating-poi
martin.spic...@gmail.com wrote:
> Hi,
>
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
>
> I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
>
> Is that known?
Yes. C has the same error as has every ot
martin.spic...@gmail.com:
> there may be a serious error in python's int() function:
>
> print int(float(2.8/0.1))
>
> yields
>
> 27
>
> instead of 28!!
It is not an error but a normal artifact of decimal-to-binary
conversion.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
there may be a serious error in python's int() function:
print int(float(2.8/0.1))
yields
27
instead of 28!!
I am using Python Python 2.7.6, GCC 4.8.2 on Linux Ubuntu.
Is that known?
Best,
Martin
--
https://mail.python.org/mailman/listinfo/python-list
50 matches
Mail list logo