No complex rationals in Python 3.0
I appreciate the inclusion of the fractions module in Python 2.6 and therefore in Python 3.0. But I feel there's something missing: no possibility for complex rationals (or arbitrary precision) integers. I was just checking the complex number support in Python, compared, for instance, to Common Lisp and Scheme, and I realized that there was this subtle omission. The inclusion of rationals and arbitrary integers is cool, but the numeric tower (say, compared to Scheme) is not complete. I don't think there would be a performance hit if complex rationals were provided. Ordinary operations on complex floats, in theory, should not be affected and handled separately. But it would be nice to be able to do: (3/4 + 1/2j) * (1/4 - j) = 11/16 - 5/8j with no loss of precision. Python is heavily used in math and science all over the world. We've even got a recent symbolic math project (sympy) that looks very promising, so I guess this could be an important issue. Note: there exists a library that implements what I'm talking about: http://calcrpnpy.sourceforge.net/clnum.html but still I personally would have liked to see this stuff included natively in the new Python 3.0. -- http://mail.python.org/mailman/listinfo/python-list
Re: No complex rationals in Python 3.0
On 24 Nov, 20:31, Christian Heimes <[EMAIL PROTECTED]> wrote: > Rock wrote: > > I appreciate the inclusion of the fractions module in Python 2.6 and > > therefore in Python 3.0. But I feel there's something missing: no > > possibility for complex rationals (or arbitrary precision) integers. I > > was just checking the complex number support in Python, compared, for > > instance, to Common Lisp and Scheme, and I realized that there was > > this subtle omission. The inclusion of rationals and arbitrary > > integers is cool, but the numeric tower (say, compared to Scheme) is > > not complete. I don't think there would be a performance hit if > > complex rationals were provided. Ordinary operations on complex > > floats, in theory, should not be affected and handled separately. But > > it would be nice to be able to do: > > > (3/4 + 1/2j) * (1/4 - j) = 11/16 - 5/8j > > > with no loss of precision. > > > Python is heavily used in math and science all over the world. We've > > even got a recent symbolic math project (sympy) that looks very > > promising, so I guess this could be an important issue. > > Nobody has submitted a PEP and patch to implement the feature in time. > There is still Python 3.1, you know? If you like to contribute the > feature then please start a discussion on the Python Ideas mailing list > (not the developer lists!). > > > Note: there exists a library that implements what I'm talking about: > >http://calcrpnpy.sourceforge.net/clnum.html > > but still I personally would have liked to see this stuff included > > natively in the new Python 3.0. > > The code depends on the CLN library which isn't suited for the Python > core. It's written in C++ and it's licensed under GPL. Neither GPL nor > LGPL software can't be integrated into the core. We also require all > code to be compatible with C89. > > Christian Thanks Christian, will do so as soon as possible. Rock -- http://mail.python.org/mailman/listinfo/python-list
Inheritance and name clashes
Hi all :) I've really been wondering about the following lately. The question is this: if there are no (real) private or protected members in Python, how can you be sure, when inheriting from another class, that you won't wind up overriding, and possibly clobbering some important data field of the parent class, which might compromise its entire functionality? I mean, nevermind the double underscore business, I know all about it. But, honestly, not everybody uses that, so you can't really be sure about what you're doing, right? Maybe the author forgot to warn about some special member in the docs for instance, or even worse, it's a third-party library, perhaps with no source! So how can you be sure??? The way I see it ... you can't! Am I wrong? Please give me a hand on this one :) Rock -- http://mail.python.org/mailman/listinfo/python-list
Re: Inheritance and name clashes
> Object-oriented designs are difficult to design in any programming > language, and it helps to have some sort of concrete problem to drive > the discussion. Are you working on a particular design where you > think Python's philosophy will inhibit good design? My take on Python > is that it focuses more on enabling good designs than preventing bad > designs. I prefer this to Java, for example, which I feel inhibits me > from expressiveness at a higher cost than any supposed benefits > private/protected would give me. Thanks for the reply. No, I was just working with a normal library class which was supposed to be derived. So that's what I did, but in the process I found myself needing to create an instance variable and it dawned on me: "how do I know I'm not clobbering something here???" ... I'd have to look at the docs, right? But I still wasn't sure ... so, then I thought "let's look at the source", and then I found out. But! It took me some time to make sure, and I was puzzled as well. I mean, what if I have no source to look at? What if the library I'm using doesn't realase the source, or what if I just can't get my hands on it for some reason or another? That was a big disappointment with Python for sure. Somehow PHP makes me feel a little safer, in that respect at least. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Unable to get the gateway IP of wlan interface using python code
> On Nov 12, 2018, at 13:37, srinivasan wrote:
>
> Dear Python Experts,
>
> *First method:*
>
> I need to get the IP address basically the gateway IP in my setup I get it
> as "192.168.178.1" when I run the below standalone python code.
Is there a requirement to use only what comes in the standard libraries, or can
you use things from pypi?
Getting interface details is exactly why netifaces was created
https://pypi.org/project/netifaces/
damocles:src drock$ python3
Python 3.7.0 (default, Oct 28 2018, 22:17:08)
[Clang 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> gws = netifaces.gateways()
>>> gws
{'default': {2: ('192.168.69.1', 'en0')}, 2: [('192.168.69.1', 'en0', True)]}
>>> gws['default']
{2: ('192.168.69.1', 'en0’)}
—
David Rock
[email protected]
--
https://mail.python.org/mailman/listinfo/python-list
Python Guru Needed Fast!!!!
Talking Panda LLC is looking for a programmer to take over building applications for the iPod. Required skills below. Please email me personally. [EMAIL PROTECTED] - Expertise in text parsing and formatting. Specifically, developing parsers to extract meaningful information from freeform text, XML, HTML, SGML, spreadsheets and translate it to other formats. - Experience with and ideally preference for Python - The creativity required to come up with solutions that work within the constraints of the iPod Note Reader (up to 1000 notes at 4kb each, limited formatting options, etc.). The following skills are also a bonus: - Tkinter and/or Win32 API programming - COM - Apple Events - PyObjC / Cocoa - Web development -- http://mail.python.org/mailman/listinfo/python-list
Re: error with files
You are trying to write the open file (file1) in the file type.
I think that you wanted to write in file1, the data:
file1.write(file_data) # instead of file.write(file1)
2014-08-18 11:41 GMT+02:00 ngangsia akumbo :
> error
>
> yems ~ # nano testfile1
> yems ~ # python testfile1
> Enter file name: g
> write in data: g
> Traceback (most recent call last):
> File "testfile1", line 11, in
> file.write(file1)
> TypeError: function takes exactly 1 argument (0 given)
>
>
>
> import os.path
>
> save_here = '/home/yems/newfile/'
> file_name = raw_input("Enter file name: ")
> filesname = os.path.join(save_here, file_name+".txt")
>
> file1 = open(filesname, 'w')
>
> file_data = raw_input('write in data: ')
>
> file.write(file1)
>
> file1.close()
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Miguel García Lafuente - Rock Neurotiko
Do it, the devil is in the details.
The quieter you are, the more you are able to hear.
Happy Coding. Code with Passion, Decode with Patience.
If we make consistent effort, based on proper education, we can change the
world.
El contenido de este e-mail es privado, no se permite la revelacion del
contenido de este e-mail a gente ajena a él.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Collaps arrays/ list of intergers
Hi, I made a fast implementation (I'm sure that can be done better) but it works (for what I understood). Is tested in Python3.4, if you will execute in Python 2.x, or don't have mypy or don't like it, you always can remove the function annotations :) http://gist.github.com/rockneurotiko/017044d907242c2e0482 There are all the code and some own-tests :) I hope that this is what you was asking for :) Cheers! 2014-08-19 18:22 GMT+02:00 Peter Pearson : > On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), Jurgens de Bruin wrote: > > > > I do hope somebody can help me with the following: > > I have the followings lists which represent the upper and lower value > > of a range/array. > > > > a = [1,50] > > b = [75,150] > > c = [25,42] > > d = [120,149] > > e = [35,55] > > > > What I would like to happen is that overlapping range will "collapse" > > to a single range meaning the above list would become: > > > > as list a,c and e overlap they can be represented by > > f = [1,55] > > as list b and d overlap they can be represented by > > g = [75,150] > > Is your question about (a) identifying overlapping subsets of ranges, > or (b) collapsing such subsets once you have identified them? > > What output would you want if the inputs were . . . > > a = [1,50] > b = [2,10] > c = [40,60] > > ? > > -- > To email me, substitute nowhere->spamcop, invalid->net. > -- > https://mail.python.org/mailman/listinfo/python-list > -- Miguel García Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python is going to be hard
print(x) :) 2014-09-03 20:10 GMT+02:00 Seymore4Head : > import math > import random > import sys > b=[] > steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] > for x in steve: > print (steve[x]) > > Traceback (most recent call last): > File "C:\Functions\blank.py", line 7, in > print (steve[x]) > IndexError: list index out of range > -- > https://mail.python.org/mailman/listinfo/python-list > -- Miguel García Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él. -- https://mail.python.org/mailman/listinfo/python-list
Re: Best way to deal with different data types in a list comprehension
Maybe there are a different way, but you can do this:
' '.join([self.get_abbrev()] +
[str(f['value').encode('utf-8') if type(f['value']) is str else
str(f['value']
for f in self.filters
if f.has_key('value')]).strip()
2014-09-24 0:01 GMT+02:00 Larry Martell :
> I have some code that I inherited:
>
> ' '.join([self.get_abbrev()] +
>[str(f['value')
> for f in self.filters
> if f.has_key('value')]).strip()
>
>
> This broke today when it encountered some non-ascii data.
>
> I changed the str(f['value']) line to f['value'].encode('utf-8'),
> which works fine, except when f['value'] is not a string (it could be
> anything).
>
> Without rewriting this without the list comprehension, how can I write
> this to deal with both strings and non-strings?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Miguel García Lafuente - Rock Neurotiko
Do it, the devil is in the details.
The quieter you are, the more you are able to hear.
Happy Coding. Code with Passion, Decode with Patience.
If we make consistent effort, based on proper education, we can change the
world.
El contenido de este e-mail es privado, no se permite la revelacion del
contenido de este e-mail a gente ajena a él.
--
https://mail.python.org/mailman/listinfo/python-list
Re: https://www.python.org/ seems to be down
2014-09-26 8:46 GMT+02:00 Gmane : > https://www.python.org/ http://www.downforeveryoneorjustme.com/python.org -- Miguel García Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él. -- https://mail.python.org/mailman/listinfo/python-list
Re: https://www.python.org/ seems to be down
2014-09-26 9:05 GMT+02:00 Gmane : > Chris Angelico gmail.com> writes: > > I am getting the following error in my Firefox browser (OpenSuse OS): > > Secure Connection Failed > > An error occurred during a connection to www.python.org. The OCSP response > is not yet valid (contains a date in the future). (Error code: > sec_error_ocsp_future_response) > > The page you are trying to view cannot be shown because the > authenticity > of the received data could not be verified. > Please contact the web site owners to inform them of this problem. > Alternatively, use the command found in the help menu to report this broken > site. > > Shiva > > -- > https://mail.python.org/mailman/listinfo/python-list > Check your local date, usually that happens when you don't have it right. -- Miguel García Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él. -- https://mail.python.org/mailman/listinfo/python-list
Re: https://www.python.org/ seems to be down
2014-09-26 9:25 GMT+02:00 Gmane : > Hi, > > Thanks - that was the problemincorrect system date/time. The system > date time and hardware date time were off. Adjusted the system time to use > one of the online time servers and then used hwclock --systohc (as a root > user) to set the hardware clock. > > But it is weird that the data from a website fails to render because of > incorrect system date. > > Thanks, > Shiva > > -- > https://mail.python.org/mailman/listinfo/python-list > Doesn't fails the render of the data, fails the verification of the SSL certificate, all certificates have an start and end date, if you are not in that range, your browser don't verify it (that's to prevent malicious SSL certs). -- Miguel García Lafuente - Rock Neurotiko Do it, the devil is in the details. The quieter you are, the more you are able to hear. Happy Coding. Code with Passion, Decode with Patience. If we make consistent effort, based on proper education, we can change the world. El contenido de este e-mail es privado, no se permite la revelacion del contenido de este e-mail a gente ajena a él. -- https://mail.python.org/mailman/listinfo/python-list
Python assignment loop
i need to do something like this:
###
import wx
x=number
for i in range(500):
"var"+str(i)=ClassXYZ(...,x+i,...)
# code
y=number
for i in range(y):
Class(object_called_by_the_string("var"+str(i)),...)
###
i can't figure out how to do this, and could not find it on the web.
c.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python assignment loop
On 20 May 2007 20:21:52 -0700, George Sakkis <[EMAIL PROTECTED]> wrote:
> On May 20, 10:33 pm, "Silver Rock" <[EMAIL PROTECTED]> wrote:
> > i need to do something like this:
> >
> > ###
> > import wx
> > x=number
> > for i in range(500):
> >"var"+str(i)=ClassXYZ(...,x+i,...)
> >
> > # code
> > y=number
> > for i in range(y):
> >Class(object_called_by_the_string("var"+str(i)),...)
> >
> > ###
> > i can't figure out how to do this, and could not find it on the web.
> > c.
>
> Whenever you are tempted to create dynamically variables names, 99% of
> the time what you really want is a data structure, typically a dict or
> a list. In your example, a list will do:
>
> x=number
> xyz_objects = [ClassXYZ(...,x+i,...) for i in xrange(500)]
> # code
> y=number
> _objects = [Class(object_called_by_the_string(xyz,...)
> for xyz in xyz_objects[:y]]
>
> If you can't figure out what this does, lookup for "list
> comprehensions". By the way, I hope these were shortened examples and
> you're not actually using names such as 'Class' or 'ClassXYZ' in
> your actual code...
>
> George
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
hi George,
thanks for your help.
yes, that is the way I a solving the problem. using lists. so it seems
that there is no way around it then..
cheers, i am not using Class or ClassXYZ in my code :-)
--
http://mail.python.org/mailman/listinfo/python-list
classes and functions
Friends, I don´t see why using classes.. functions does everything already. I read the Rossum tutotial and two other already. Maybe this is because I am only writing small scripts, or some more serious misunderstandings of the language. Please give me a light. thanks guys, Claire -- http://mail.python.org/mailman/listinfo/python-list
OSS and ALSA
Hi all, I've seen that python comes by default with a module for communication with OSS. I've looked for a ALSA module too (pyalsa) but it seems to handle only limited operations. Can anyone confirm or point wrong the impression that a newbie should use the ossaudiodev module? thanks, cl -- http://mail.python.org/mailman/listinfo/python-list
OSS and ALSA
Hi all, I've seen that python comes by default with a module for communication with OSS. I've looked for a ALSA module too (pyalsa) but it seems to handle only limited operations. Is it recommended that one programm using oss becouse of Alsa's OSS compatibility? thanks, claire -- http://mail.python.org/mailman/listinfo/python-list
SndObj-Pysonic-omde-MusicKit-Jack-Alsa
Greetings,
I've been studiyng python and some things are not that clear:
1- Is python too slow to efectivelly communicate with Jack? PyJack did not
seem to work right, so i tried PySndObj's JackIO object. It did not behave
as good as with connection with ALSA.
(btw, I could not acess lots of objects in the SndObj library (like Ocil,
Rand, while acessing normally Oscilli and Randh...) Does anyone know why?)
2- Python comes with the ossaudiodev module for communication with OSS; Alsa
is compatible so it works. Shuld one use this module or use the pyalsasound?
3- pySonic - pySonic the wrapper for the FMOD sound library. but it is not
opensource... is there a standard library for sound processing in projects
like ardour.
4- Are any differences between 'r' and 'rb'; 'w' and 'wb' in:
wave.open('file', 'r')wave.open('file', 'rb')
wave.open('file', 'w') wave.open('file', 'wb')
??
5- I found pySonic, that seems good but it is not open. MusicKit and
PySndObj and omde. Ow yeah, and Pygame. Can anyone expose ihre personal
experience and explain why?
Please be nice,
Claire
--
http://mail.python.org/mailman/listinfo/python-list
wave
hallo, supose i´ve opened a sound with the wave module: import wave sound=wave.open(filename,'rb') now this is strange: sound.getnframes() != len(sound.readframes(sound.getnframes()) True Why so? thanks in advance, Claire -- http://mail.python.org/mailman/listinfo/python-list
