Re: [Tutor] Unable to get the gateway IP of wlan interface using python code

2018-11-12 Thread David Rock

> 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
da...@graniteweb.com




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: https://www.python.org/ seems to be down

2014-09-26 Thread Rock Neurotiko
2014-09-26 8:46 GMT+02:00 Gmane shivaji...@yahoo.com.dmarc.invalid:

 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 Thread Rock Neurotiko
2014-09-26 9:05 GMT+02:00 Gmane shivaji...@yahoo.com.dmarc.invalid:

 Chris Angelico rosuav at 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 Thread Rock Neurotiko
2014-09-26 9:25 GMT+02:00 Gmane shivaji...@yahoo.com.dmarc.invalid:

 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


Re: Best way to deal with different data types in a list comprehension

2014-09-23 Thread Rock Neurotiko
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 larry.mart...@gmail.com:

 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: Python is going to be hard

2014-09-03 Thread Rock Neurotiko
print(x)

:)


2014-09-03 20:10 GMT+02:00 Seymore4Head Seymore4Head@hotmail.invalid:

 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 module
 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: Collaps arrays/ list of intergers

2014-08-19 Thread Rock Neurotiko
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 ppearson@nowhere.invalid:

 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: error with files

2014-08-18 Thread Rock Neurotiko
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 ngang...@gmail.com:

 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 module
 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


[issue21862] cProfile command-line should accept -m module_name as an alternative to script path

2014-06-24 Thread Rock Lee

Rock Lee added the comment:

I tweaked the Lib/cProfile.py a little bit to get the feature done, please 
review the patch attached.

--
keywords: +patch
nosy: +rock
Added file: 
http://bugs.python.org/file35775/cProfile-add-new-option-module.patch

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



[issue17933] format str bug in urllib request.py

2013-07-22 Thread Rock Lee

Rock Lee added the comment:

Any progress for this issue?

I changed the title of the issue.

--
title: test_ftp failure / ftplib error formatting issue - format str bug in 
urllib request.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Bug in urllib/request.py.
format string formatted error type variable 

 2373 except ftplib.error_perm as reason:
 2374   raise URLError('ftp error: %d' % reason) from reason

variable reason here is a instance of class ftplib.error_perm.
We need to passed in a integer object. 

Patch supplied.

--
keywords: +patch
nosy: +rock
Added file: 
http://bugs.python.org/file30967/urllib-request-format-type-bug.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Fixed like this:

raise URLError('ftp error: %d' % int(str(reason)[:3])) from reason

I think this is the original author's intention. 

Actually, need to fix two places in urllib/request.py

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

yes, the malformed server could do evil things.  If we need to cover this 
situation, we need to some extra fixes in this file. 

Maybe the exception message look like this is the better one ?
   ftplib.error_perm: 550 Failed to change directory

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Yes, the simplest fix is just replace '%d' to '%s'.

Line 2362 and 2374 all need to modify.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-16 Thread Rock Li

Rock Li added the comment:

You are right. I checked the GLibc implementation of readdir and readdir_r, 
there's no global variale used in the function readdir. Just as the POSIX 
standards says, This data is not overwritten by another call to readdir() on a 
different directory stream. 

To the second question, now I understood. POSIX does not specify the size of 
the d_name field. This will cause our codes a bit inconvenient.

Next time, I will check the POSIX specifications and related several 
implementations first, not just the documents.

Thx All.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-15 Thread Rock Li

New submission from Rock Li:

When I'm how glob module is implemented. I found in file posixmodule.c, the 
function posix_listdir is using readdir to get all the entries under one 
directory and the context is setted to allow multi threads. But the function 
readdir is not thread-safe, so I changed this call to use readdir_r instead. 

I'm using the lastest codes in the repo.

--
components: Extension Modules
files: mywork.patch
keywords: patch
messages: 184224
nosy: Rock
priority: normal
severity: normal
status: open
title: replace readdir to readdir_r in function posix_listdir
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29413/mywork.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-15 Thread Rock Li

Rock Li added the comment:

Hi Ross, 

What about if one implementation of posix use the global variable to store 
something. From `man readdir`, I didn't see the sentence This data is not 
overwritten by another call to readdir() on a different directory stream..

And from the link you gived, 

Background

The POSIX readdir_r function is a thread-safe version of the readdir function 
used to read directory entries. Whereas readdir returns a pointer to a 
system-allocated buffer and may use global state without mutual exclusion, 
readdir_r uses a user-supplied buffer and is guaranteed to be reentrant. Its 
use is therefore preferable or even essential in portable multithreaded 
programs.


Actually readdir_r is guaranteed to be reentrant. By using readdir, I think 
just like to use errno in a multi thread programs, we can't always think it 
will work as the right way. But readdir_r, we can. 

And another question, you say 
struct dirent should not be allocated on the stack since the last field may be 
an unspecified size.

What does this mean? Can you explain detail to me?
Thx.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-30 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Erm.. No. I was unaware I had to do so.
Next time I'll be more careful.

Anyways, the docs say that python should throw a RuntimeError, but it didn't?
And would it be doable to add a warning at the top of the multiprocessing 
tutorial/page that section?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

New submission from Rock Achu rockac...@gmail.com:

running this script repeatedly causes corruption in the console window. 

Just before posting this report, it led to a complete windows system freeze.

running python 2.7 x86 on windows x64.

The programs seems to run a couple times (when it is supposed to run once), 
with the output becoming more and more corrupted. 
One time it printed lots of triple quotes () and import os messages, even 
though none of those are in the script.

To reproduce run the spawner.test.bat file inside the zip.

Remember not to run with stuff you wont want to lose open.

--
components: Windows
files: issue.zip
messages: 150355
nosy: Rock.Achu
priority: normal
severity: normal
status: open
title: Multiprocessing system crash
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file24108/issue.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

I hit Ctrl-C right after opening the bat file and got this mess:

--
Added file: http://bugs.python.org/file24109/error.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

On a hunch opened task manager. There were over 9000 python processes open. 
Shocking. 

That was probably the cause of the system freeze.

However I only had 20 threads open. Why so many processes?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Or did I only have 20 threads?
if the program was running in a loop, then it would have spawned 20 threads 
each, leading to the huge amount of processes, and probably the other issues.


So why does it run so many times?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Ok, using other code, I narrowed it down to this code and before:
for i in xrange(10):
spawner.newproc(run=True)

repeating infinitely


which only should set a variable (self.busy) to false

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

By inserting print statements and feverishly killing the process, I narrowed it 
down to the statement:
self.thread.start()
that causes the issue.
which runs _M_Process.func() in a multiprocessing.Process

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

More clues:

the function _M_Process.func isn't being called.




--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Changing the function name and removing the argument (self) passed to func 
doesn't change  a thing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Alright. The issue stays here. Passing nothing to multiprocessing.Process still 
reproduces the issue.


someone else know how to deal with this?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13679] Multiprocessing system crash

2011-12-29 Thread Rock Achu

Rock Achu rockac...@gmail.com added the comment:

Alright. Just running:

import multiprocessing
thread = multiprocessing.Process()
thread.start()

raw_input()


-
Causes the crash. This time there is no output, so it is essentailly invisible. 
Caught me by surprise.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13679
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Inheritance and name clashes

2010-10-03 Thread Rock
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

2010-10-03 Thread Rock
 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


No complex rationals in Python 3.0

2008-11-24 Thread Rock
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

2008-11-24 Thread Rock
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


Python assignment loop

2007-05-20 Thread Silver Rock
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

2007-05-20 Thread Silver Rock
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

2007-03-02 Thread Silver Rock
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


SndObj-Pysonic-omde-MusicKit-Jack-Alsa

2007-02-03 Thread Silver Rock

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

2007-02-03 Thread Silver Rock

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

OSS and ALSA

2007-02-02 Thread Silver Rock

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

OSS and ALSA

2007-02-01 Thread Silver Rock

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

Python Guru Needed Fast!!!!

2005-11-30 Thread j-rock
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