Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Ulrich Eckhardt

Am 30.07.2012 02:44, schrieb Steven D'Aprano:

I wish to extract the bit fields from a Python float, call it x. First I
cast the float to 8-bytes:

s = struct.pack('=d', x)
i = struct.unpack('=q', s)[0]

Then I extract the bit fields from the int, e.g. to grab the sign bit:

(i & 0x8000) >> 63


Questions:

1) Are there any known implementations or platforms where Python floats
are not C doubles? If so, what are they?


The struct docs refer to C's double type, so it depends on that type 
probably. However, regardless of C's double type, the same docs refer to 
the IEEE form when packed into a byte array. Is it just the 
representation you are after or some specific behaviour?




2) If the platform byte-order is reversed, do I need to take any special
action? I don't think I do, because even though the float is reversed, so
will be the bit mask. Is this correct?


Yes, the code is fine. If you have doubts, I have a big-endian system at 
home (Linux/PowerPC) where I could run tests.




3) Any other problems with the way I am doing this?


Python docs refer to IEEE-754, not 784? Typo?


Uli

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


Linux shell to python

2012-07-30 Thread Vikas Kumar Choudhary
Dear friends,

I just joined the group.
I was trying porting from bash shell to python.

let me know if someone has tried to implement (grep and PIPE)  shell commands 
in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'
 
I tried to use python subprocess and OS.Popen modules.

Thanks & Regard's

Vikas Kumar Choudhary 


(Yahoo,MSN-Hotmail,Skype) Messenger = vikas.choudhary
Please Add Me in Your Messenger List for Better Communication
P  Please consider the environment before printing this e-mail
Do not print this email unless it is absolutely necessary. 
Save papers, Save tree.

Note: This e-mail is confidential and may also be privileged, this is for the 
intended recipients only. If you are not the intended recipient, please delete 
the message and notify me immediately; you should not copy or use it for any 
purpose, nor disclose its contents to any other person.

Notice:  All email and instant messages (including attachments) sent to or from 
This E-mail id , may be retained, monitored and/or reviewed, or authorized law 
enforcement personnel, without further notice or consent.
--
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux shell to python

2012-07-30 Thread Chris Angelico
On Mon, Jul 30, 2012 at 5:05 PM, Vikas Kumar Choudhary
 wrote:
>
> I was trying porting from bash shell to python.
>
> let me know if someone has tried to implement (grep and PIPE)  shell commands 
> in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'

Welcome!

While it's technically possible to do exactly that in Python (using
subprocess as you describe), there's usually a more efficient and
cleaner method of achieving the same goal. With a port such as you
describe, it's probably best to go right back to the conceptual level
and work out what exactly you're trying to do, and then look at
implementing that in Python. You'll end up with much cleaner code at
the end of it.

For an initial guess, I would say that you'll use subprocess to invoke
lspci, but then everything else will be done in Python directly.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Chris Angelico
On Mon, Jul 30, 2012 at 4:07 PM, Stefan Behnel  wrote:
> Still, you may still get away with the above statement by providing a
> sufficiently narrow definition of "standalone". By my definition, there
> isn't much "standalone" code out there. Most code I know interfaces with a
> couple of external tools, libraries or backends, usually written in
> languages I don't have to care about because they provide a language
> independent interface.

Agreed, and the flip-side of that is that there aren't many
mono-language developers either. Sure, it'd be possible to make a
career of nothing but Objective-C, writing apps for Apple to make all
the money off, but even then you'll probably benefit from knowing some
glue languages.

Python's an excellent glue language, but it's also fine for huge
applications. Yes, it can't multithread across cores if you use
CPython and are CPU-bound. That's actually a pretty specific
limitation, and taking out any component of that eliminates the GIL as
a serious problem.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Mark Dickinson
On Monday, July 30, 2012 1:44:04 AM UTC+1, Steven D'Aprano wrote:
> 1) Are there any known implementations or platforms where Python floats 
> are not C doubles? If so, what are they?

Well, IronPython is presumably using .NET Doubles, while Jython will be using 
Java Doubles---in either case, that's specified to be the IEEE 754 binary64 
type.

For CPython, and I guess PyPy too, we're using C doubles, which in theory are 
in whatever format the platform provides, but in practice are always IEEE 754 
binary64 again.

So you're pretty safe assuming IEEE 754 binary64 format.  If you ever meet a 
current Python running on a system that *doesn't* use IEEE 754 for its C 
doubles, please let me know---there are a lot of interesting questions that 
would come up in that case.   

> 2) If the platform byte-order is reversed, do I need to take any special 
> 
> action? I don't think I do, because even though the float is reversed, so 
> 
> will be the bit mask. Is this correct?

True; on almost all current platforms, the endianness of int types matches the 
endianness of float types.But to be safe, why not use ' 3) Any other problems with the way I am doing this?

You might consider whether you want to use 'http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-30 Thread Dieter Maurer
"Eric S. Johansson"  writes:

> When you are sitting on or in a name, you look to the left or look to
> the right what would you see that would tell you that you have gone
> past the end of that name. For example
>
> a = b + c
>
> if you are sitting on a, the boundaries are beginning of line and =,
> if you are sitting on b, the boundaries are = and +, if you are
> sitting on c, the boundaries are + and end of line.  a call the region
> between those boundaries the symbol region.

Check the lexical definitions. They essentially define, what
a "symbol region" is.

In essence, you have names, operators, literals whitespace and comments --
each with quite a simple definition.

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


Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Dieter Maurer
Chris Gonnerman  writes:

> I've been making some minor updates to the PollyReports module I
> announced a while back, and I've noticed that when I upload it to
> PyPI, my changelog (CHANGES.txt) doesn't appear to be integrated into
> the site at all.  Do I have to put the changes into the README, or
> have I missed something here?  It seems that there should be some
> automatic method whereby PyPI users could easily see what I've changed
> without downloading it first.

"CHANGES.txt" is not automatically presented.
If necessary, you must integrate it into the "long description".

However, personally, I am not interested in all the details (typically
found in "CHANGES.txt") but some (often implicit) information is
sufficient for me: something like "major API change", "minor bug
fixes". Thus, think carefully what you put on the overview page.

I find it very stupid to see several window scrolls of changes for
a package but to learn how to install the package, I have to download its
source...

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


Re: simplified Python parsing question

2012-07-30 Thread Laszlo Nagy


I appreciate the help because I believe that once this is working, 
it'll make a significant difference in the ability for disabled 
programmers to write code again as well as be able to integrate within 
existing development team and their naming conventions. 


Did you try to use pygments?

http://pygments.org/docs/api/

It already contains a lexer for Python source code. You can create a 
Lexer (pygments.lexer.Lexer) then call its get_tokens method.


Then you can use this to identify statements:

http://docs.python.org/reference/simple_stmts.html

Fortunately, almost all statements begin with a keyword. There are some 
exceptions:


expression statement
assignment statement

I would first tokenize the code, then divide it by statement keywords. 
Finally, you just need to find expression/assignment statements in the 
remaining sections. (Maybe there is a better way to do it.)


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


Re: newbie: write content in a file (server-side)

2012-07-30 Thread Thomas Kaufmann
Am Sonntag, 29. Juli 2012 17:16:11 UTC+2 schrieb Peter Otten:
> Thomas Kaufmann wrote:
> 
> 
> 
> > I send from a client file content to my server (as bytes). So far so good.
> 
> > The server receives this content complete. Ok. Then I want to write this
> 
> > content to a new file. It works too. But in the new file are only the
> 
> > first part of the whole content.
> 
> > 
> 
> > What's the problem.
> 
> 
> 
> > Here's my server code:
> 
> 
> 
> > while True:
> 
> > bytes = self.request.recv(4096)
> 
> > if bytes:
> 
> > s  = bytes.decode("utf8")
> 
> > print(s)
> 
> > li = s.split("~")
> 
> > with open(li[0], 'w') as fp:
> 
> > fp.write(li[1])
> 
> 
> 
> - Do you ever want to leave the loop?
> 
> 
> 
> - You calculate a new filename on every iteration of the while loop -- 
> 
> probably not what you intended to do.
> 
> 
> 
> - The "w" argument tells Python to overwrite the file if it exists. You 
> 
> either need to keep the file open (move the with... out of the loop) or open 
> 
> it with "a".
> 
> 
> 
> - You may not receive the complete file name on the first iteration of the 
> 
> while loop.
> 
> 
> 
> - The bytes buffer can contain incomplete characters, e. g.:
> 
> 
> 
> >>> data = b"\xc3\xa4"
> 
> >>> data.decode("utf-8")
> 
> 'ä'
> 
> >>> data[:1].decode("utf-8")
> 
> Traceback (most recent call last):
> 
>   File "", line 1, in 
> 
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 0: 
> 
> unexpected end of data


Thanks Peter. It helps;-).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: write content in a file (server-side)

2012-07-30 Thread Thomas Kaufmann
Am Sonntag, 29. Juli 2012 16:16:01 UTC+2 schrieb Thomas Kaufmann:
> Hi,
> 
> 
> 
> I send from a client file content to my server (as bytes). So far so good.
> 
> The server receives this content complete. Ok. Then I want to write this 
> content to a new file. It works too. But in the new file are only the first 
> part of the whole content.
> 
> 
> 
> What's the problem. 
> 
> 
> 
> o-o
> 
> 
> 
> Thomas
> 
> 
> 
> Here's my server code:
> 
> 
> 
> 
> 
> 
> 
> import socketserver
> 
> 
> 
> class MyTCPServer(socketserver.BaseRequestHandler):
> 
> 
> 
> def handle(self):
> 
> 
> 
> s  = '' 
> 
> li = []
> 
> addr = self.client_address[0]
> 
> print("[{}] Connected! ".format(addr))
> 
> while True:
> 
> 
> 
> bytes = self.request.recv(4096)
> 
> if bytes:
> 
> s  = bytes.decode("utf8")
> 
> print(s)
> 
> li = s.split("~")
> 
> with open(li[0], 'w') as fp:
> 
> fp.write(li[1])
> 
> 
> 
> #... main ..
> 
> 
> 
> if __name__ == "__main__":
> 
> 
> 
> server = socketserver.ThreadingTCPServer(("", 12345), MyTCPServer)
> 
> server.serve_forever()


Thanks a lot. It helps.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-30 Thread Eric S. Johansson

On 7/30/2012 5:25 AM, Laszlo Nagy wrote:


Did you try to use pygments?

http://pygments.org/docs/api/



thanks, I'll take a look.



I would first tokenize the code, then divide it by statement keywords. 
Finally, you just need to find expression/assignment statements in the 
remaining sections. (Maybe there is a better way to do it.)






yeah the problem is also little more complicated than simple parsing of Python 
code. For example, one example (from the white paper)


*meat space blowback = Friends and family [well-meaning attempt]

*could that be parsed by the tools you mention? I suspect not but this is what I 
need to generate using speech recognition because it's easily spoken. A more 
complex example might be something like


new base = OS path-base name (old path)

or

if OS base exists (current path): new base name = OS path base name(current 
path)

What's particularly cute here is that using the translation technique I can 
actually describe the full object method path with a minimum of speaking 
overhead. Python is great. :-)


But the questions remain, will these tools are stuff like this?


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


Re: Linux shell to python

2012-07-30 Thread Philipp Hagemeister
On 07/30/2012 09:05 AM, Vikas Kumar Choudhary wrote:
> `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'

The rough Python equivalent would be

import subprocess
[ l.partition(' ')[0]  # or l[:7], if you want to copy it verbatim
  for l in subprocess.check_output(['lspci']).splitlines()
  if 'Q' in l and isp_str1 in l and isp_str2 in l
]

You can also just paste the whole pipeline with the shell=True
parameter. That's not recommended though, and it's hard to correctly
quote strings.

- Philipp



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Tim Chase
On 07/29/12 21:31, Rodrick Brown wrote:
> Its still not possible to be a pure Python developer and find
> gainful employment today.

I'm not sure where you get your facts, but unless you define "pure"
in a super-narrow way, it's just flat-out wrong.  I've been employed
doing primarily Python for the past 7+ years.  Yes, there's been
some SQL involved; yes, I've done code-reviews for somebody else's
C# (the nice thing about C-like languages is they all read mostly
the same); yes, some of the web apps have required knowing
ECMAScript, HTML, XML, CSS, etc.  But the day to day is mostly
coding in Python.  And the several recruiters that have contacted me
in the past week or two about additional Python positions seem to
think there are pure Python jobs available.

Maybe you intended to write "not possible to be a poor Python
developer and find gainful employment today" which could surely be
the case, as I've met LOTS of programmers (Python and otherwise)
that I'd never consider hiring because of their poor
skills/understanding of their tools.

-tkc



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


Re: Linux shell to python

2012-07-30 Thread 张少华
you can use commands.getstatusoutput(command), the shell command  special 
charactor (like "$ and so on )should be escaped!


在 2012年7月30日星期一UTC+8下午3时40分04秒,Chris Angelico写道:
> On Mon, Jul 30, 2012 at 5:05 PM, Vikas Kumar Choudhary
> 
>  wrote:
> 
> >
> 
> > I was trying porting from bash shell to python.
> 
> >
> 
> > let me know if someone has tried to implement (grep and PIPE)  shell 
> > commands in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | 
> > cut -c1-7'
> 
> 
> 
> Welcome!
> 
> 
> 
> While it's technically possible to do exactly that in Python (using
> 
> subprocess as you describe), there's usually a more efficient and
> 
> cleaner method of achieving the same goal. With a port such as you
> 
> describe, it's probably best to go right back to the conceptual level
> 
> and work out what exactly you're trying to do, and then look at
> 
> implementing that in Python. You'll end up with much cleaner code at
> 
> the end of it.
> 
> 
> 
> For an initial guess, I would say that you'll use subprocess to invoke
> 
> lspci, but then everything else will be done in Python directly.
> 
> 
> 
> ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Error

2012-07-30 Thread Duncan Booth
Jürgen A. Erhard  wrote:

> Peter's right, but instead of a print before the line, put a
> try/except around it, like
> 
>try:
>   set1 = set(list1)
>except TypeError:
>   print list1
>   raise
> 
> This way, only the *actual* error triggers any output.  With a general
> print before, you can get a lot of unnecessary output.
> 
> Grits, J
> 

Or even better:

   try:
  set1 = set(list1)
   except TypeError:
  print list1
  import pdb; pdb.set_trace()
  raise

Then the error will print the value of list1 and drop you into the debugger 
so you can examine what's going on in more detail.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux shell to python

2012-07-30 Thread Jürgen A . Erhard
On Mon, Jul 30, 2012 at 12:35:38PM +0200, Philipp Hagemeister wrote:
> On 07/30/2012 09:05 AM, Vikas Kumar Choudhary wrote:
> > `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'
> 
> The rough Python equivalent would be
> 
> import subprocess
> [ l.partition(' ')[0]  # or l[:7], if you want to copy it verbatim
>   for l in subprocess.check_output(['lspci']).splitlines()
>   if 'Q' in l and isp_str1 in l and isp_str2 in l
> ]

Ouch.  A list comprehension spanning more than one line is bad code
pretty much every time.

But you did qualify it as "rough" :D

Grits, J
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux shell to python

2012-07-30 Thread Peter Otten
Vikas Kumar Choudhary wrote:


> let me know if someone has tried to implement (grep and PIPE)  shell
> commands in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2"
> | cut -c1-7'
> 
> I tried to use python subprocess and OS.Popen modules.

subprocess is the way to go.

> I was trying porting from bash shell to python.

Here's an example showing how to translate a shell pipe:

http://docs.python.org/library/subprocess.html#replacing-shell-pipeline

But even if you can port the shell script literally I recommend a more 
structured approach:

import subprocess
import itertools

def parse_data(lines):
for not_empty, group in itertools.groupby(lines, key=bool):
if not_empty:
triples = (line.partition(":") for line in group)
pairs = ((left, right.strip()) for left, sep, right in triples)
yield dict(pairs)

if __name__ == "__main__":
def get(field):
return entry.get(field, "").lower()
output = subprocess.Popen(["lspci", "-vmm"], 
stdout=subprocess.PIPE).communicate()[0]
for entry in parse_data(output.splitlines()):
if "nvidia" in get("Vendor") and "usb" in get("Device"):
print entry["Slot"]
print entry["Device"]
print


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


Re: Linux shell to python

2012-07-30 Thread Philipp Hagemeister
On 07/30/2012 01:31 PM, Jürgen A. Erhard wrote:
> On Mon, Jul 30, 2012 at 12:35:38PM +0200, Philipp Hagemeister wrote:
>> import subprocess
>> [ l.partition(' ')[0]  # or l[:7], if you want to copy it verbatim
>>   for l in subprocess.check_output(['lspci']).splitlines()
>>   if 'Q' in l and isp_str1 in l and isp_str2 in l
>> ]
> 
> Ouch.  A list comprehension spanning more than one line is bad code
> pretty much every time.

I didn't want to introduce a separate function, but as requested, here's
the function version:

def pciIds(searchWords=['Q', isp_str1, isp_str2]):
  for l in subprocess.check_output(['lspci']).splitlines():
if all(sw in l for sw in searchWords):
yield l.partition(' ')[0]

You could also separate the processing, like this:

lines = subprocess.check_output(['lspci']).splitlines()
lines = [l for l in lines if 'Q' in l and isp_str1 in l and isp_str2 in l]
# Or:
lines = filter(lambda l: 'Q' in l and isp_str1 in l and isp_str2 in l,
lines)


[l.partition(' ')[0] for l in lines]
# Or:
map(lambda l: l.partition(' ')[0], lines)

But personally, I have no problem with three-line list comprehensions.
Can you elaborate why the list comprehension version is bad code?

Or more to the point, how would *you* write it?

- Philipp




signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python] Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Chris Gonnerman

On 07/30/2012 04:20 AM, Dieter Maurer wrote:

"CHANGES.txt" is not automatically presented.
If necessary, you must integrate it into the "long description".

However, personally, I am not interested in all the details (typically
found in "CHANGES.txt") but some (often implicit) information is
sufficient for me: something like "major API change", "minor bug
fixes". Thus, think carefully what you put on the overview page.
I see your point.  I'm just lazy, I guess.  I already put a description 
of what I've changed into git, so why, I muse, must I also edit the 
overview page separately?  I was hoping there was an automatic way that 
"setup.py sdist upload" could handle it for me.



I find it very stupid to see several window scrolls of changes for
a package but to learn how to install the package, I have to download its
source...
Not sure I get this.  The installation procedure for PollyReports is the 
same as for, what, 99% of Python source packages?


sudo python setup.py install

What else are you saying I should do?

-- Chris.

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


Re: [Python] Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Chris Gonnerman

On 07/29/2012 11:00 PM, Ben Finney wrote:
Your post is showing up as a reply to a thread about IEEE-784 floats, 
because you created your message as a reply. Consequently, it's rather 
confusing why you suddenly start talking about PollyReports. If you 
want to attract attention to an unrelated topic, it's best if you 
don't reply to an existing thread; instead, start a new thread by 
composing a new message to the forum. 
My apologies.  I did not consider that headers I can't see might be 
being sent along.

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


Re: Is Python a commercial proposition ?

2012-07-30 Thread Roy Smith
In article ,
 Chris Angelico  wrote:

> Python's an excellent glue language, but it's also fine for huge
> applications. Yes, it can't multithread across cores if you use
> CPython and are CPU-bound. That's actually a pretty specific
> limitation, and taking out any component of that eliminates the GIL as
> a serious problem.

These days, I'm working on a fairly large web application (songza.com).  
The business/application logic is written entirely in Python (mostly as 
two django apps).  That's what we spend 80% of our developer time 
writing.

As for scale, we're currently running on 80 cores worth of AWS servers 
for the front end.  Another 50 or so cores for the database and other 
backend functions.  Yesterday (Sunday, so a slow day), we served 27 
million HTTP requests; we're not facebook-sized, but it's not some 
little toy application either.

Every time we look at performance, we can't hardly measure the time it 
takes to run the Python code.  Overall, we spend (way) more time waiting 
on network I/O than anything else.  Other than I/O, our biggest 
performance issue is slow database queries, and making more queries than 
we really need to.

The engineering work to improve performance involves restructuring our 
data representation in the database, caching (at multiple levels), or 
eliminating marginal features which cost more than they're worth.  None 
of this would be any different if we used C++, except that we'd spend so 
much time writing and debugging code that we'd have no time left to 
think about the really important stuff.

As far as the GIL is concerned, it's just not an issue for us.  We run 
lots of server processes.  Perhaps not as elegant as running fewer 
multi-threaded processes, but it works just fine, is easy to implement, 
and we never have to worry about all the horrors of getting memory 
management right in a multi-threaded C++ application.
-- 
http://mail.python.org/mailman/listinfo/python-list


py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread maniandram01
I created py2c ( http://code.google.com/p/py2c )- an open source Python to 
C/C++ translator!
py2c is looking for developers!
To join create a posting in the py2c-discuss Google Group or email me!
Thanks
PS:I hope this is the appropiate group for this message.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread lipska the kat

On 30/07/12 14:06, Roy Smith wrote:

In article,
  Chris Angelico  wrote:


Python's an excellent glue language, but it's also fine for huge
applications. Yes, it can't multithread across cores if you use
CPython and are CPU-bound. That's actually a pretty specific
limitation, and taking out any component of that eliminates the GIL as
a serious problem.


These days, I'm working on a fairly large web application (songza.com).
The business/application logic is written entirely in Python (mostly as
two django apps).  That's what we spend 80% of our developer time
writing.



snip

"We are very sorry to say that due to licensing constraints we cannot 
allow access to Songza for listeners located outside of the United States."


Arse :-(

Lipska

--
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Grant Edwards
On 2012-07-30, Stefan Behnel  wrote:

> Still, you may still get away with the above statement by providing a
> sufficiently narrow definition of "standalone". By my definition, there
> isn't much "standalone" code out there. Most code I know interfaces with a
> couple of external tools, libraries or backends, usually written in
> languages I don't have to care about because they provide a language
> independent interface.

It's not really relevent to this discussion, but there is _lots_ of
stand-alone code out there. It runs in sub-one-dollar microcontrollers
that are programmed in assembly language or in C without external
libraries (sometimes not even the "libc" that's included in the C
language definition).  Those microcontrollers are everywhere in toys,
appliances, and all sorts of other "non-computer" things.

-- 
Grant Edwards   grant.b.edwardsYow! Mr and Mrs PED, can I
  at   borrow 26.7% of the RAYON
  gmail.comTEXTILE production of the
   INDONESIAN archipelago?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Grant Edwards
On 2012-07-30, Steven D'Aprano  wrote:

> 1) Are there any known implementations or platforms where Python floats 
> are not C doubles? If so, what are they?

And the question you didn't ask: are there any platforms where a C
double isn't IEEE-754?

The last ones I worked on that where the FP format wasn't IEEE were
the DEC VAX and TI's line if 32-bit floating-point DSPs.  I don't
think Python runs on the latter, but it might on the former.

-- 
Grant Edwards   grant.b.edwardsYow! I was born in a
  at   Hostess Cupcake factory
  gmail.combefore the sexual
   revolution!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Roy Smith
In article ,
 Grant Edwards  wrote:

> The last ones I worked on that where the FP format wasn't IEEE were
> the DEC VAX 

According to http://en.wikipedia.org/wiki/Vax#History, the last VAX was 
produced 7 years ago.  I'm sure there's still more than a few chugging 
away in corporate data centers and manufacturing floors, but as an 
architecture, it's pretty much a dead parrot.

IEEE floating point is as near to a universal standard as it gets in the 
computer world.  About the only thing that has it beat for market 
penetration and longevity are 2's complement integers and 8-bit bytes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Mark Lawrence

On 30/07/2012 15:16, Grant Edwards wrote:

On 2012-07-30, Steven D'Aprano  wrote:


1) Are there any known implementations or platforms where Python floats
are not C doubles? If so, what are they?


And the question you didn't ask: are there any platforms where a C
double isn't IEEE-754?

The last ones I worked on that where the FP format wasn't IEEE were
the DEC VAX and TI's line if 32-bit floating-point DSPs.  I don't
think Python runs on the latter, but it might on the former.



Support for Python on VMS has been dropped for v3.3 see 
http://bugs.python.org/issue11918


--
Cheers.

Mark Lawrence.

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


Re: simplified Python parsing question

2012-07-30 Thread Laszlo Nagy




yeah the problem is also little more complicated than simple parsing 
of Python code. For example, one example (from the white paper)


*meat space blowback = Friends and family [well-meaning attempt]

*could that be parsed by the tools you mention?


It is not valid Python code. Pygments is able to tokenize code that is 
not valid Python code. Because it is not parsing, it is just tokenizing. 
But if you put a bunch of random tokens into a file, then of course you 
will never be able to split that into statements.


Probably, you will need to process ident/dedent tokens, identify the 
"level" of the satement. And then you can tell what file, class, inner 
class, method you are staying in. Inside one "level" or code block, you 
could try to divide the code into statements.


Otherwise, I have no idea how a blind person could navigate in a Python 
source. In fact I have no idea how they use regular programs. So I'm 
affraid I cannot help too much with this. :-(



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


CfP: 5th International Workshop on Multi-Core Computing Systems (MuCoCoS)

2012-07-30 Thread SP
***
 Paper submission deadline: September 9, 2012
***
 5th International Workshop on
 Multi-Core Computing Systems (MuCoCoS)
 2012 Focus: Performance Portability and Tuning

 Salt Lake City, Utah, November 16, 2012
 In conjunction with the Supercomputing Conference SC12

 
***
 Workshop proceedings are published by the IEEE
***

CONTEXT

The pervasiveness of homogeneous and heterogeneous multi-core and
many-core processors, in a large spectrum of systems from embedded and
general-purpose to high-end computing systems, poses major challenges
to software industry. In general, there is no guarantee that software
developed for a particular architecture will be executable (that is
functional) on another architecture. Furthermore, ensuring that the
software preserves some aspects of performance behavior (such as
temporal or energy efficiency) across different such architectures is
an open research issue.

Therefore, this workshop focuses on novel solutions for functional and
performance portability as well as automatic tuning across different
architectures.

Following the successful organization of MuCoCoS 2008 (Barcelona,
Spain), MuCoCoS 2009 (Fukuoka, Japan), MuCoCoS 2010 (Krakow, Poland),
MuCoCoS 2011 (Seoul, Korea), this year MuCoCoS will be organized at
Salt Lake City, Utah, November 16, 2012, in conjunction with the
Supercomputing Conference SC12. MuCoCoS 2012 focuses on Performance
Portability and Tuning.

TOPICS OF INTEREST

- The topics of the workshop include but are not limited to:

:: Performance measurement, modeling, analysis and tuning
:: Portable programming models, languages and compilation
techniques
:: Tunable algorithms and data structures
:: Run-time systems and hardware support mechanisms for auto-
tuning
:: Case studies highlighting performance portability and tuning

SUBMISSION GUIDELINES

- The papers should be prepared using the IEEE format, and no longer
than 10 pages. Submitted papers will be carefully evaluated based on
originality, significance to workshop topics, technical soundness, and
presentation quality.

- Submission of the paper implies that should the paper be accepted,
at
least one of the authors will register and present the paper at the
workshop. Papers will be published as a part of the SC12 digital
proceedings. These are IEEE digital library proceedings that will be
available online.

- Please submit your paper (as PDF) electronically using the online
submission system.
(https://www.easychair.org/account/signin.cgi?conf=mucocos2012)

SPECIAL JOURNAL ISSUE

Authors of the best MuCoCoS papers will be invited to submit their
extended workshop papers to a special issue of Computing journal (©
Springer) that will be developed for this workshop.

IMPORTANT DATES

- Submission: September 9, 2012
- Notification: October 14, 2012
- Registration: October 17, 2012
- Workshop: November 16, 2012

WORKSHOP CO-CHAIRS

- Sabri Pllana, University of Vienna, Austria
 
- Jacob Barhen, Oak Ridge National Laboratory, US
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread andrea crotti
2012/7/30  :
> I created py2c ( http://code.google.com/p/py2c )- an open source Python to 
> C/C++ translator!
> py2c is looking for developers!
> To join create a posting in the py2c-discuss Google Group or email me!
> Thanks
> PS:I hope this is the appropiate group for this message.
> --
> http://mail.python.org/mailman/listinfo/python-list

It looks like a very very hard task, and really useful or for exercise?

The first few lines I've seen there are the dangerous * imports and
LazyStrin looks like a typo..

from ast import *
import functools
from c_types import *
from lazystring import *
#constant data
empty = LazyStrin
ordertuple = ((Or,),(And
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-30 Thread Eric S. Johansson

On 7/30/2012 10:59 AM, Laszlo Nagy wrote:




yeah the problem is also little more complicated than simple parsing of 
Python code. For example, one example (from the white paper)


*meat space blowback = Friends and family [well-meaning attempt]

*could that be parsed by the tools you mention?


It is not valid Python code. Pygments is able to tokenize code that is not 
valid Python code. Because it is not parsing, it is just tokenizing. But if 
you put a bunch of random tokens into a file, then of course you will never be 
able to split that into statements.


If you have been reading the papers, you would understand what I'm doing. I'm 
trying to take Python code with speech recognition friendly symbols and 
translate the symbols into a code friendly form. My conjecture is that you can 
change your perspective on the code and look for the edge that would normally be 
used to define start of a symbol, you should be able to define the name string. 
Another possibility is looking at the region which just contains letters numbers 
and spaces and outside and use that as your definition of a name string. It 
would probably help to verify that each word is found in a dictionary although 
that adds extra complexity if you are trying to increase the dictionary at the 
same time as the translation table.


I'm beginning to think for the first generation I should just use regular 
expressions looking forwards and backwards and try to enumerate the possible cases.


Probably, you will need to process ident/dedent tokens, identify the "level" 
of the satement. And then you can tell what file, class, inner class, method 
you are staying in. Inside one "level" or code block, you could try to divide 
the code into statements.


I was starting in that direction so that is good confirmation



Otherwise, I have no idea how a blind person could navigate in a Python 
source. In fact I have no idea how they use regular programs. So I'm affraid I 
cannot help too much with this. :-(


I'm sorry, I am, and I'm trying to help, hand disabled programmers. There are 
more disability than blindness and after almost 20 years of encountering this 
shortsightedness, I do get a little cranky at times. :-)





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


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Grant Edwards
On 2012-07-30, Mark Lawrence  wrote:
> On 30/07/2012 15:16, Grant Edwards wrote:
>> On 2012-07-30, Steven D'Aprano  wrote:
>>
>>> 1) Are there any known implementations or platforms where Python floats
>>> are not C doubles? If so, what are they?
>>
>> And the question you didn't ask: are there any platforms where a C
>> double isn't IEEE-754?
>>
>> The last ones I worked on that where the FP format wasn't IEEE were
>> the DEC VAX and TI's line if 32-bit floating-point DSPs.  I don't
>> think Python runs on the latter, but it might on the former.
>>
>
> Support for Python on VMS has been dropped for v3.3 see 
> http://bugs.python.org/issue11918

I imagine that VAXes running Unix went extinct in the wild long before
VAXes running VMS.

-- 
Grant Edwards   grant.b.edwardsYow! Did YOU find a
  at   DIGITAL WATCH in YOUR box
  gmail.comof VELVEETA?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Mark Dickinson
On Monday, July 30, 2012 3:16:05 PM UTC+1, Grant Edwards wrote:
> The last ones I worked on that where the FP format wasn't IEEE were
> 
> the DEC VAX and TI's line if 32-bit floating-point DSPs.  I don't
> 
> think Python runs on the latter, but it might on the former.

For current hardware, there's also IBM big iron:  the IBM System z10 apparently 
has hardware support for IBM's hexadecimal floating-point format in addition to 
IEEE 754 binary *and* decimal floating-point.  But IIUC, a typical Linux 
installation on one of these machines uses the IEEE 754 stuff, not the 
hexadecimal bits.  So unlikely to be an issue for Python.

-- 
Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread rusi
On Jul 29, 9:01 pm, lipska the kat  wrote:
> Pythoners
>
> Firstly, thanks to those on the tutor list who answered my questions.
>
> I'm trying to understand where Python fits into the set of commonly
> available, commercially used languages of the moment.
>
> My most recent experience is with Java. The last project I was involved
> with included 6775 java source files containing 1,145,785 lines of code.
> How do I know this? because I managed to cobble together a python script
> that walks the source tree and counts the lines of code. It ignores
> block and line comments and whitespace lines so I'm fairly confident
> it's an accurate total. It doesn't include web interface files (mainly
> .jsp and HTML) or configuration files (XML, properties files and what
> have you). In fact it was remarkably easy to do this in python which got
> me thinking about how I could use the language in a commercial environment.
>
> I was first attracted to python by it's apparent 'Object Orientedness' I
> soon realised however that by looking at it in terms of the language I
> know best I wasn't comparing like with like. Once I had 'rebooted the
> bioware' I tried to approach python with an open mind and I have to say
> it's growing on me.
>
> The questions I have are ...
>
> How is python used in the real world.
> What sized projects are people involved with
> Are applications generally written entirely in python or is it more
> often used for a subset of functionality.

I think when people talk of scripting this area tends to get missed:
(Or if someone mentioned it, I missed it :-) )
http://wiki.python.org/moin/AppsWithPythonScripting
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread MaxTheMouse
On Jul 30, 7:27 am, maniandra...@gmail.com wrote:
> I created py2c (http://code.google.com/p/py2c)- an open source Python to 
> C/C++ translator!
> py2c is looking for developers!
> To join create a posting in the py2c-discuss Google Group or email me!
> Thanks
> PS:I hope this is the appropiate group for this message.

Out of curiosity.
What is the difference between this and Shedskin? Shedskin being a
(restricted) python-to-C++ compiler. (http://code.google.com/p/
shedskin/) Is the goal to be able to handle any python code or a
subset?

Cheers,
Adam
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 12:44 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> I wish to extract the bit fields from a Python float, call it x. First I
> cast the float to 8-bytes:
>
> s = struct.pack('=d', x)
> i = struct.unpack('=q', s)[0]
>
> Then I extract the bit fields from the int, e.g. to grab the sign bit:
>
> (i & 0x8000) >> 63
>
>
> Questions:
>
> 1) Are there any known implementations or platforms where Python floats
> are not C doubles? If so, what are they?
>
Last I heard, DEC Alpha chips did not use IEEE floating point.


> 2) If the platform byte-order is reversed, do I need to take any special
> action? I don't think I do, because even though the float is reversed, so
> will be the bit mask. Is this correct?
>
> 3) Any other problems with the way I am doing this?
>
It gives me the heebie jeebies.  Why go to all the trouble and incur the
lack of portability to esoteric platforms, when you can just use arithmetic
expressions?  It's fancy, and it'll probably almost always work, but it's
probably not so wise.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Linux shell to python

2012-07-30 Thread Paul van der Linden
You can do this with one subprocess.Popen and some python commands.

The alternative is to pipe some subprocess.Popen commands together.

Or for the quick way out (but I think you better stick with bash scripting 
then): http://pypi.python.org/pypi/sarge/

Don't know about it's stability/ubs/etc, never used it.
 
-Original message-
From:Vikas Kumar Choudhary 
Sent:Mon 30-07-2012 09:34
Subject:Linux shell to python
To:python-list@python.org; 
 
Dear friends,

I just joined the group.
I was trying porting from bash shell to python.

 let me know if someone has tried to implement (grep and PIPE)  shell commands 
in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'
 I tried to use python subprocess and OS.Popen modules.

Thanks & Regard's

Vikas Kumar Choudhary 


(Yahoo,MSN-Hotmail,Skype) Messenger = vikas.choudhary
Please Add Me in Your Messenger List for Better Communication
 
P  Please consider the environment before printing this e-mail
Do not print this email unless it is absolutely necessary. 
Save papers, Save tree.

Note: This e-mail is confidential and may also be privileged, this is for the 
intended recipients only. If you are not the intended recipient, please delete 
the message and notify me immediately; you should not copy or use it for any 
purpose, nor disclose its contents to any other person.

Notice:  All email and instant messages (including attachments) sent to or from 
This E-mail id , may be retained, monitored and/or reviewed, or authorized law 
enforcement personnel, without further notice or consent.
--
 

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

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


RE: simplified Python parsing question

2012-07-30 Thread Paul van der Linden
Another possibility is to use the ast module of python: 
http://docs.python.org/library/ast.html

The only problem with that module, is that everything you parse must be 
correct, otherwise it throws an exception, I don't know if that's a problem for 
your project?
 
-Original message-
From:Eric S. Johansson 
Sent:Mon 30-07-2012 12:00
Subject:Re: simplified Python parsing question
To:python-list@python.org; 
On 7/30/2012 5:25 AM, Laszlo Nagy wrote:
>
> Did you try to use pygments?
>
> http://pygments.org/docs/api/
>

thanks, I'll take a look.

>
> I would first tokenize the code, then divide it by statement keywords. 
> Finally, you just need to find expression/assignment statements in the 
> remaining sections. (Maybe there is a better way to do it.)
>
>
>

yeah the problem is also little more complicated than simple parsing of Python 
code. For example, one example (from the white paper)

*meat space blowback = Friends and family [well-meaning attempt]

*could that be parsed by the tools you mention? I suspect not but this is what 
I 
need to generate using speech recognition because it's easily spoken. A more 
complex example might be something like

new base = OS path-base name (old path)

or

if OS base exists (current path): new base name = OS path base name(current 
path)

What's particularly cute here is that using the translation technique I can 
actually describe the full object method path with a minimum of speaking 
overhead. Python is great. :-)

But the questions remain, will these tools are stuff like this?


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


Re: Is Python a commercial proposition ?

2012-07-30 Thread Emile van Sebille

On 7/29/2012 5:12 PM Rodrick Brown said...

Until the
GIL is fixed I doubt anyone will seriously look at Python as an option
for large enterprise standalone application development.


See openERP -- http://www.openerp.com/ -- they've been actively 
converting SAP accounts and have recently absorbed a couple SAP resellers.


Emile


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


[ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Pedro Kroger
Pyknon is a simple music library for Python hackers. With Pyknon you
can generate Midi files quickly and reason about musical proprieties.
It works with Python 2.7 and 3.2.

Pyknon is very simple to use, here's a basic example to create 4 notes
and save into a MIDI file::

from pyknon.genmidi import Midi
from pyknon.music import NoteSeq

notes1 = NoteSeq("D4 F#8 A Bb4")
midi = Midi(1, tempo=90)
midi.seq_notes(notes1, track=0)
midi.write("demo.mid")


It's available on PyPI and its homepage is
http://kroger.github.com/pyknon/

Best regards,

Pedro
-
http://pedrokroger.net
http://musicforgeeksandnerds.com

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


Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Ethan Furman

Pedro Kroger wrote:

Pyknon is a simple music library for Python hackers.


Sounds cool.  How is 'Pyknon' pronounced?



It's available on PyPI and its homepage is
http://kroger.github.com/pyknon/


I would suggest you change the theme -- using Firefox 3.6 the page is 
very difficult to read.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Pedro Kroger

On Jul 30, 2012, at 3:33 PM, Ethan Furman  wrote:

> Pedro Kroger wrote:
>> Pyknon is a simple music library for Python hackers.
> 
> Sounds cool.  How is 'Pyknon' pronounced?

I pronounce it similarly as google translate does:

http://translate.google.com/#English|English|Pyknon

It's a musical Greek term, but since it's a Python package, I think it's 
acceptable
to pronounce the Py part as "pie" ;-)

>> It's available on PyPI and its homepage is
>> http://kroger.github.com/pyknon/
> 
> I would suggest you change the theme -- using Firefox 3.6 the page is very 
> difficult to read.

Thanks for the report. Do you mind if I ask why you are using such an old 
version?
(It looks fine with Firefox 14.0.1)

Cheers,

Pedro
-
http://pedrokroger.net
http://musicforgeeksandnerds.com

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


RE: Is Python a commercial proposition ?

2012-07-30 Thread Prasad, Ramit
> I work in financials and the majority of our apps are developed in C++
> and Java yet all the tools that startup, deploy and conduct rigorous
> unit testing are implemented in Python or Shell scripts that wrap
> Python scripts.
> 
> Python definitely has its place in the enterprise however not so much
> for serious stand alone app development.
> 
> I'm starting to see Python used along side many statistical and
> analytical tools like R, SPlus, and Mathlab for back testing and
> prototype work, in a lot of cases I've seen quants and traders
> implement models in Python to back test and if successful converted to
> Java or C++.

Maybe this is true in *your* experience but *my* experience is very 
different. I have seen Python modules become modules that end up 
rewritten in C for performance reasons but I consider that part of the 
power of Python and an argument *for* Python.

Ramit
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Ethan Furman

Pedro Kroger wrote:


On Jul 30, 2012, at 3:33 PM, Ethan Furman > wrote:



Pedro Kroger wrote:

Pyknon is a simple music library for Python hackers.


Sounds cool.  How is 'Pyknon' pronounced?


I pronounce it similarly as google translate does:


So the 'k' is pronounced.  Okay.


I would suggest you change the theme -- using Firefox 3.6 the page is 
very difficult to read.


Thanks for the report. Do you mind if I ask why you are using such an 
old version?

(It looks fine with Firefox 14.0.1)



That version works for me -- I don't like upgrading to a new version of 
bugs if I don't have to.  ;)


I checked the page on a coworker's machine who does have a recent 
version, and it is a little better, but it is still very faint (thin 
grey letters on a white background is hard to read).  With version 3 the 
thin grey letters are also broken, making it even worse.


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


RE: [Python] Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Prasad, Ramit
> > However, personally, I am not interested in all the details (typically
> > found in "CHANGES.txt") but some (often implicit) information is
> > sufficient for me: something like "major API change", "minor bug
> > fixes". Thus, think carefully what you put on the overview page.

> I see your point.  I'm just lazy, I guess.  I already put a description
> of what I've changed into git, so why, I muse, must I also edit the
> overview page separately?  I was hoping there was an automatic way that
> "setup.py sdist upload" could handle it for me.

Even if you could include commit messages I would not recommend it.
Commit messages are for developers of _your_ package not users. It is
like leaving a memo (cough or message) for future developers.

As a user, I want to know that you added a feature AAA. I do *not*
want to know that in order to add AAA you also had to modify BBB
and create CCC. Maybe you had to revert BBB because it conflicted
with DDD and then you refactored some code and added/updated
comments. Finally you managed to fix BBB (maybe also modifying DDD?)
and so the feature AAA is now available.  


Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Prasad, Ramit
> >> I would suggest you change the theme -- using Firefox 3.6 the page is
> >> very difficult to read.
> >
> > Thanks for the report. Do you mind if I ask why you are using such an
> > old version?
> > (It looks fine with Firefox 14.0.1)
> 
> 
> That version works for me -- I don't like upgrading to a new version of
> bugs if I don't have to.  ;)

Why do you prefer to keep your old security holes? 

Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extracting bit fields from an IEEE-784 float

2012-07-30 Thread Roy Smith
In article ,
 Grant Edwards  wrote:

> I imagine that VAXes running Unix went extinct in the wild long before
> VAXes running VMS.

Of course they did.  VMS is all about vendor lock-in.  People who 
continue to run VAXen don't do so because they're wedded to the 
hardware.  They do so because they're wedded to some specific VMS 
application (and the business processes which depend on it).
-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN] New paper published (Volume 7 of The Python Papers) - High-Speed Data Shredding using Python

2012-07-30 Thread mauricel...@acm.org
Link: http://ojs.pythonpapers.org/index.php/tpp/article/view/243

Abstract

In recent years, backup and restore is a common topic in data storage. However, 
there’s hardly anybody mention about safe data deletion. Common data 
destruction methodology requires the wipe operation to fill the disk with 
zeros, then with random data, and then with zeros again. Three passes are 
normally sufficient for ordinary home users. On the down side, such algorithms 
will take many hours to delete a 2TB hard disk. Although current Linux utility 
tools gives most users more than enough security and data protections, we had 
developed a cross-platform standalone application that could expunge all 
confidential data stored in flash drive or hard disk. The data shredding 
software is written in Python, and it could overwrite existing data using 
user-defined wipe algorithm. This software project also explores the technical 
approaches to digital data destruction using various methodologies defined in 
different standards, which includes a selection of military-grade procedures 
proposed by information security specialists. The application operates with no 
limitations to the capacity of the storage media connected to the computer 
system, it can rapidly and securely erase any magnetic mediums, optical disks 
or solid-state memories found in the computer or embedded system. Not only does 
the software comply with the IEEE T10/T13 specifications, it also binds to the 
number of connectivity limited by the SAS/SATA buses.

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


[ANN] New paper published (Volume 7 of The Python Papers) - Designing and Testing PyZMQ Applications

2012-07-30 Thread mauricel...@acm.org
Link: http://ojs.pythonpapers.org/index.php/tpp/article/view/242

Abstract

PyZMQ is a powerful and easy-to-use network layer. While ZeroMQ and PyZMQ are 
quite well documented and good introductory tutorials exist, no best-practice 
guide on how to design and especially to test larger or more complex PyZMQ 
applications could be found. This article shows a possible way to design, 
document and test real-world applications. The approach presented in this 
article was used for the development of a distributed simulation framework and 
proved to work quite well in this scenario. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux shell to python

2012-07-30 Thread Barry Scott
lspci gets all its information from the files in /sys/bus/pci/devices.

You can use os.listdir() to list all the files in the folder and then open
the files you want to get the data you need.

And of course you can write list comprehensions on as many lines as
it take to make the code maintainable.

Barry


On 30 Jul 2012, at 17:55, Paul van der Linden  wrote:

> You can do this with one subprocess.Popen and some python commands.
> The alternative is to pipe some subprocess.Popen commands together.
> Or for the quick way out (but I think you better stick with bash scripting 
> then): http://pypi.python.org/pypi/sarge/
> Don't know about it's stability/ubs/etc, never used it.
>  
> -Original message-
> From: Vikas Kumar Choudhary 
> Sent: Mon 30-07-2012 09:34
> Subject:  Linux shell to python
> To:   python-list@python.org; 
> Dear friends,
> 
> I just joined the group.
> I was trying porting from bash shell to python.
> 
>  
> let me know if someone has tried to implement (grep and PIPE)  shell commands 
> in python `lspci | grep Q | grep  "$isp_str1" | grep "$isp_str2" | cut -c1-7'
>  
> I tried to use python subprocess and OS.Popen modules.
> 
> Thanks & Regard's
> 
> Vikas Kumar Choudhary 
> 
> 
> (Yahoo,MSN-Hotmail,Skype) Messenger = vikas.choudhary
> Please Add Me in Your Messenger List for Better Communication
> P  Please consider the environment before printing this e-mail
> Do not print this email unless it is absolutely necessary. 
> Save papers, Save tree.
> 
> Note: This e-mail is confidential and may also be privileged, this is for the 
> intended recipients only. If you are not the intended recipient, please 
> delete the message and notify me immediately; you should not copy or use it 
> for any purpose, nor disclose its contents to any other person.
> 
> Notice:  All email and instant messages (including attachments) sent to or 
> from This E-mail id , may be retained, monitored and/or reviewed, or 
> authorized law enforcement personnel, without further notice or consent.
> --
>  
> -- 
>  http://mail.python.org/mailman/listinfo/python-list
>  
> -- 
> http://mail.python.org/mailman/listinfo/python-list

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


Re: Linux shell to python

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott  wrote:

> lspci gets all its information from the files in /sys/bus/pci/devices.
>


> You can use os.listdir() to list all the files in the folder and then open
> the files you want to get the data you need.
>
Gee, wouldn't it be more portable to parse lspci?  I wouldn't put it past
the (Linux) kernel devs to move the pseudo-filesystems around again...


> And of course you can write list comprehensions on as many lines as
> it take to make the code maintainable.
>
Sigh, and I'm also not keen on multi-line list comprehensions, specifically
because I think they tend to make less readable code.  It also becomes a
mess when you need to insert print statements to get some visibility into
what's going on.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Linux shell to python

2012-07-30 Thread Emile van Sebille

On 7/30/2012 3:56 PM Dan Stromberg said...


On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott 


And of course you can write list comprehensions on as many lines as
it take to make the code maintainable.

Sigh, and I'm also not keen on multi-line list comprehensions,
specifically because I think they tend to make less readable code.  It
also becomes a mess when you need to insert print statements to get some
visibility into what's going on.


I tend to write long one-liners then convert them to loops the first 
time I need to see what's going on.


Premature optimization otherwise.  :)

Emile



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


Re: Linux shell to python

2012-07-30 Thread Dan Stromberg
On Mon, Jul 30, 2012 at 11:14 PM, Emile van Sebille  wrote:

> On 7/30/2012 3:56 PM Dan Stromberg said...
>
>
>> On Mon, Jul 30, 2012 at 9:26 PM, Barry Scott >
>
>  And of course you can write list comprehensions on as many lines as
>> it take to make the code maintainable.
>>
>> Sigh, and I'm also not keen on multi-line list comprehensions,
>> specifically because I think they tend to make less readable code.  It
>> also becomes a mess when you need to insert print statements to get some
>> visibility into what's going on.
>>
>
> I tend to write long one-liners then convert them to loops the first time
> I need to see what's going on.
>
> Premature optimization otherwise.  :)
>

Premature optimization of what?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread alex23
On Jul 31, 2:42 am, MaxTheMouse  wrote:
> What is the difference between this and Shedskin? Shedskin being a
> (restricted) python-to-C++ compiler. (http://code.google.com/p/
> shedskin/) Is the goal to be able to handle any python code or a
> subset?

There's also Nuitka, which is an unrestricted compiler, I believe:
http://nuitka.net/pages/overview.html

Is this a completely independent project, or are there plans to
leverage off of PyPy's toolchain, for example?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread alex23
On Jul 30, 12:31 pm, Rodrick Brown  wrote:
> Its still not possible to be a pure Python developer and find gainful
> employment today.

I have been working as a "pure" Python developer for six+ years now
(in that the bulk of my coding is done in Python, with some interface
behaviour in JS). On average, every two months I'm contacted by a
recruiter or an employer wanting me for my Python experience. I've
worked for government, education and private industry, and the only
time I didn't get paid was my last week working for a start-up.

So I'm pretty confident that I'm "gainfully" employed.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-30 Thread alex23
On Jul 30, 3:18 pm, jwp  wrote:
> What's c.l.py's perspective on managing interfaces and implementations?

I've been working with Plone for the past year and have become a big
fan of interfaces. I must admit I _do_ like zope.interface's
adaptation, but your's looks lighter in a way that could be handy for
a side project, so I may have some more concrete feedback soon :)

BTW I think if you rename the ReStructured Text docs to .rst github
will automatically render them.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-30 Thread jwp
On Monday, July 30, 2012 6:09:10 PM UTC-7, alex23 wrote:
> a side project, so I may have some more concrete feedback soon :)

=)

> BTW I think if you rename the ReStructured Text docs to .rst github
> 
> will automatically render them.

Did not know that. Gonna go do a lot of git mv's now.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2012 11:40:50 -0400, Eric S. Johansson wrote:

> If you have been reading the papers, you would understand what I'm
> doing. 

That is the second time, at least, that you have made a comment like that.

Understand that most people are not going to follow links to find out 
whether or not they are interested in what you have to say. If you can't 
give a brief explanation of what you are doing in your email or news 
post, many people aren't going to read on. Perhaps they intend to but are 
too busy, or they have email access but web access is restricted, or 
they've already got 200 tabs open in their browser and don't want any 
more (I'm not exaggerating, I know people like that).

People use email because it is a "push" technology -- you don't have to 
go out and look for information, it gets pushed into your inbox. Clicking 
on links is a "pull" technology -- you have to make the explicit decision 
to click the link, open a browser, go out to the Internet and read who 
knows what. That requires a different frame of mind. Expect to lose some 
of your audience every time you require them to follow a link.

And *especially* so if that it a link to Google Docs, instead of an 
normal web page. Google Docs is, in my opinion, a nasty piece of rubbish 
that doesn't run on any of my browsers. As far as I'm concerned, I'd 
rather download a Word doc, because at least I can open that in 
OpenOffice or Abiword and read it. Something in Google Docs might as well 
be locked in a safe as far as I'm concerned.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2012 18:41:19 -0700, jwp wrote:

>> BTW I think if you rename the ReStructured Text docs to .rst github
>> will automatically render them.
> 
> Did not know that. Gonna go do a lot of git mv's now.

Do *one* and see if github actually does render it. Then do the rest.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2012 14:09:38 +, Grant Edwards wrote:

> On 2012-07-30, Stefan Behnel  wrote:
> 
>> Still, you may still get away with the above statement by providing a
>> sufficiently narrow definition of "standalone". By my definition, there
>> isn't much "standalone" code out there. Most code I know interfaces
>> with a couple of external tools, libraries or backends, usually written
>> in languages I don't have to care about because they provide a language
>> independent interface.
> 
> It's not really relevent to this discussion, but there is _lots_ of
> stand-alone code out there. It runs in sub-one-dollar microcontrollers
> that are programmed in assembly language or in C without external
> libraries (sometimes not even the "libc" that's included in the C
> language definition).  Those microcontrollers are everywhere in toys,
> appliances, and all sorts of other "non-computer" things.

And at that level, you aren't going to write your app in Python anyway, 
and not because of the GIL. (These microcontrollers are unlikely to have 
multiple cores -- why the hell does your microwave oven need two cores?)

It seems to me that those who claim that the GIL is a serious barrier to 
Python's use in the enterprise are mostly cargo-cult programmers, 
parroting what they've heard from other cargo-cultists. It really is 
astonishing the amount of misinformation and outright wrong-headed 
ignorance that counts as accepted wisdom in the enterprise.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simplified Python parsing question

2012-07-30 Thread Eric S. Johansson

On 7/30/2012 9:54 PM, Steven D'Aprano wrote:

On Mon, 30 Jul 2012 11:40:50 -0400, Eric S. Johansson wrote:


If you have been reading the papers, you would understand what I'm
doing.

That is the second time, at least, that you have made a comment like that.


Actually, it's probably more like the forth hundred time. :-) I apologize, I was 
wrong and I would back up and start over again if I could


Understand that most people are not going to follow links to find out
whether or not they are interested in what you have to say. If you can't
give a brief explanation of what you are doing in your email or news
post, many people aren't going to read on. Perhaps they intend to but are
too busy, or they have email access but web access is restricted, or
they've already got 200 tabs open in their browser and don't want any
more (I'm not exaggerating, I know people like that).


accept criticism. I'm still working on an elevator pitch for this concept. I've 
been living with the technology and all its variations for about 10 years and 
it's not easy to explain to someone who is not disabled. People with working 
hands don't understand how isolating and, sometimes humiliating software can be. 
advocates like myself sometimes get a little tired of saying the same thing over 
and over and over again and people who are disabled just don't care. So you find 
yourself using shorthand because you going to be ignored anyway


People use email because it is a "push" technology -- you don't have to
go out and look for information, it gets pushed into your inbox. Clicking
on links is a "pull" technology -- you have to make the explicit decision
to click the link, open a browser, go out to the Internet and read who
knows what. That requires a different frame of mind. Expect to lose some
of your audience every time you require them to follow a link.


Okay, this implies the need to really work on more of an elevator/summary 
speech. Thank you for your input. I appreciate it


And *especially* so if that it a link to Google Docs, instead of an
normal web page. Google Docs is, in my opinion, a nasty piece of rubbish
that doesn't run on any of my browsers. As far as I'm concerned, I'd
rather download a Word doc, because at least I can open that in
OpenOffice or Abiword and read it. Something in Google Docs might as well
be locked in a safe as far as I'm concerned.


the ability for multiple people to work on the same document at the same time is 
really important. Can't do that with Word or Libre office.  revision tracking  
in traditional word processors are unpleasant to work with especially if your 
hands are broken.


It would please me greatly if you would be willing to try an experiment. live my 
life for a while. Sit in a chair and tell somebody what to type and where to 
move the mouse without moving your hands. keep your hands gripping the arms or 
the sides of the chair. The rule is you can't touch the keyboard you can't touch 
the mice, you can't point at the screen. I suspect you would have a hard time 
surviving half a day with these limitations. no embarrassment in that, most 
people wouldn't make it as far as a half a day.  I've had to live with it since 
1994. Not trying to brag, just pointing out the facts.


I'm going to try again from a different angle in a different thread. I will take 
your advice to heart and I would appreciate some feedback on how well I do 
satisfying the issues you have described


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


Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2012 19:32:47 +, Prasad, Ramit wrote:

>> >> I would suggest you change the theme -- using Firefox 3.6 the page
>> >> is very difficult to read.
>> >
>> > Thanks for the report. Do you mind if I ask why you are using such an
>> > old version?
>> > (It looks fine with Firefox 14.0.1)

Firefox 3.6 is not "such an old version". It is the currently supported 
version in RHEL and Centos, and under the rebranded name Iceweasel, 
Debian Squeeze.


>> That version works for me -- I don't like upgrading to a new version of
>> bugs if I don't have to.  ;)
> 
> Why do you prefer to keep your old security holes?

I don't. But in my experience, the risk of security breaches is *much* 
less than the chance that the new version will break functionality, 
introduce bugs, have a worse user interface, and generally be a step 
backwards rather than forward.

Security fixes are orthogonal to new features and UI changes. Any 
software which forces you to take unwanted new features and accept UI 
degradation in order to get security fixes is doing the wrong thing, and 
almost certainly adding new security holes as fast as they remove them.

When it comes to browsers, I would rather rely on dedicated security 
features like NoScript that has a stable UI and continual functional 
improvements, than to get on the Firefox upgrade treadmill. When I 
upgrade my OS, I'll get a new major release of Firefox. With luck, all 
the kinks will be ironed out by then. Until then, Firefox 3.6 is stable 
and works.

Besides, it is amazing what a better browsing experience you get by 
disabling 99% of all Flash and 95% of all Javascript.

Python is one of the few cases where I can implicitly trust that each 
upgrade is an actual *upgrade*, not a downgrade with a higher version 
number like KDE 3 -> KDE 4, or a sidegrade, like Firefox.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] New paper published (Volume 7 of The Python Papers) - High-Speed Data Shredding using Python

2012-07-30 Thread Simon Cropper

On 31/07/12 07:36, mauricel...@acm.org wrote:

Link: http://ojs.pythonpapers.org/index.php/tpp/article/view/243

Abstract

In recent years, backup and restore is a common topic in data storage. However, 
there’s hardly anybody mention about safe data deletion. Common data 
destruction methodology requires the wipe operation to fill the disk with 
zeros, then with random data, and then with zeros again. Three passes are 
normally sufficient for ordinary home users. On the down side, such algorithms 
will take many hours to delete a 2TB hard disk. Although current Linux utility 
tools gives most users more than enough security and data protections, we had 
developed a cross-platform standalone application that could expunge all 
confidential data stored in flash drive or hard disk. The data shredding 
software is written in Python, and it could overwrite existing data using 
user-defined wipe algorithm. This software project also explores the technical 
approaches to digital data destruction using various methodologies defined in 
different standards, which includes a selection of military-grade procedures 
proposed

by information security specialists. The application operates with no 
limitations to the capacity of the storage media connected to the computer 
system, it can rapidly and securely erase any magnetic mediums, optical disks 
or solid-state memories found in the computer or embedded system. Not only does 
the software comply with the IEEE T10/T13 specifications, it also binds to the 
number of connectivity limited by the SAS/SATA buses.




The paper is very interesting.

Funny though  I found it very hard to find a name of the application 
developed -- I presume it is the successor of CBL Data Shredder -- or if 
it is foss or proprietary package?


Does the application have a project page?

--
Cheers Simon

   Simon Cropper - Open Content Creator

   Free and Open Source Software Workflow Guides
   
   Introduction   http://www.fossworkflowguides.com
   GIS Packages   http://www.fossworkflowguides.com/gis
   bash / Pythonhttp://www.fossworkflowguides.com/scripting
--
http://mail.python.org/mailman/listinfo/python-list


toggle name, With explanations

2012-07-30 Thread Eric S. Johansson
the wonderful responses I received from people like Lazlo, Paul, and Stephen has 
given me some ideas about a different approach. First, here's explanation of 
what I'm doing


I'm developing a method which will enable hand disabled developers such as 
myself to create and manipulate symbols identical to those created by 
non-disabled developers. the input mechanism will be speech recognition 
maximizing the use of ordinary continuous English dictation and a minimal set of 
commands to activate this method. Subsequent work will produce a speech user 
interface for navigation code and tools such as debuggers bypassing the 
interference and constraints created by GUIs.


The core concept is any string of a natural language words can be transformed 
into a symbol by storing the matchup between the natural language word string 
and the symbol string in a database.  in other words, a dictionary which has 
paired keys and one key can return the other.


in my original request I was thinking about parsing the environment and looking 
for the transition between code and symbol or natural language word string but 
unfortunately, that technique breaks because the characters around the region of 
interest may not be complete or correct code. So I thought about trying to look 
at the other way. If you find a string of characters that you don't look like a 
symbol or look like a string of natural in words, when the characters stop 
looking like that, then that defines the limits of the region of interest.


example:

s.pack(side=Tkinter.R^IGHT, fill=Tkinter.Y)

the carrot marks the current position. If I was to say this point, "toggle 
word", I would first look to the left and the right and look forward the 
character string stopped looking like a symbol or a natural language word 
string.in this example, I would find the string "RIGHT". If I didn't find 
anything, I would look one more character to the left and see if there was a "." 
present, do the same search again this time solely to the left and I would have 
the string "TKinter.RIGHT". The database would have the in tree and replace it 
with "TK interpreter right" so I could edit the string with speech recognition.


s.pack(side=TK interpreter^ right, fill=Tkinter.Y)

Then using the same basic technique as I described above, I looked left and 
right for a series of symbols, in this case they are actually words, until I 
reach something that is not a symbol. The end result is used a key for the 
database which would return "Tkinter.RIGHT"


It looks like if I'm correct, this is a much simpler way of doing what I wanted 
to do (extract symbols and natural language word strings).


1) can you see any holes in this logic?
2) what would you recommend for regular expressions. The reason I ask is that if 
you have spaces in the string, you only want want alphanumeric sequences,
if you have alphanumeric plus symbol special characters, you don't want spaces. 
I'm not sure how strict that precondition should be. I'm going to

need to think about it more. Opinions would be welcome.

I think this works for almost any language too which is really important in the 
disabled programmer community.


I appreciate your patience. Sometimes the overhead of communicating using speech 
recognition with tools don't work well with speech recognition such as
Thunderbird makes the whole process of writing almost more difficult than it's 
worth. Working on tools like this is incremental progress I need to make
in order to be able to bring speech recognition-based accessibility to the 
Python world.


--- eric



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


OT: accessibility (was "Re: simplified Python parsing question")

2012-07-30 Thread Tim Chase
On 07/30/12 21:11, Eric S. Johansson wrote:
> the ability for multiple people to work on the same document at 
> the same time is really important. Can't do that with Word or 
> Libre office.  revision tracking in traditional word processors 
> are unpleasant to work with especially if your hands are broken.

If you're developing, I might recommend using text-based storage and
actual revision-control software.  Hosting HTML (or Restructured
Text, or plain-text, or LaTeX) documents on a shared repository such
as GitHub or Bitbucket provides nicely for accessible documentation
as well as much more powerful revision control.

> It would please me greatly if you would be willing to try an 
> experiment. live my life for a while. Sit in a chair and tell 
> somebody what to type and where to move the mouse without moving 
> your hands. keep your hands gripping the arms or the sides of
> the chair. The rule is you can't touch the keyboard you can't
> touch the mice, you can't point at the screen. I suspect you
> would have a hard time surviving half a day with these
> limitations. no embarrassment in that, most people wouldn't make
> it as far as a half a day.

I've tried a similar experiment and am curious on your input device.
 Eye-tracking/dwell-clicking?  A sip/puff joystick?  Of the various
input methods I tried, I found that Dasher[1] was the most
intuitive, had a fairly high input rate and accuracy (both
initially, and in terms of correcting mistakes I'd made).  It also
had the ability to generate dictionaries/vocabularies that made more
appropriate/weighted suggestions which might help in certain
contexts (e.g. pre-load a Python grammar allowing for choosing full
atoms in a given context).

-tkc

[1]
http://en.wikipedia.org/wiki/Dasher
http://www.inference.phy.cam.ac.uk/dasher/





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


Re: ANN: visage (interfaces)

2012-07-30 Thread jwp
On Monday, July 30, 2012 7:09:03 PM UTC-7, Steven D'Aprano wrote:
> Do *one* and see if github actually does render it. Then do the rest.

Did it for one project. It does render it. =)

Naturally, sphinx autodoc links don't work. =( Come-on github, use dat fundin'
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Paul Rubin
Steven D'Aprano  writes:
> And at that level, you aren't going to write your app in Python anyway, 
> and not because of the GIL. (These microcontrollers are unlikely to have 
> multiple cores -- why the hell does your microwave oven need two cores?)

http://greenarrays.com ;-)

> It seems to me that those who claim that the GIL is a serious barrier to 
> Python's use in the enterprise are mostly cargo-cult programmers, 

I would say, it puts a crimp into Python's versatility but there are
still lots of areas where it's not a serious issue.  A real compiler
(PyPy) will help Python performance far more than multi-core currently
can.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2c - an open source Python to C/C++ is looking for developers

2012-07-30 Thread Stefan Behnel
alex23, 31.07.2012 02:16:
> On Jul 31, 2:42 am, MaxTheMouse wrote:
>> What is the difference between this and Shedskin? Shedskin being a
>> (restricted) python-to-C++ compiler. (http://code.google.com/p/
>> shedskin/) Is the goal to be able to handle any python code or a
>> subset?
> 
> There's also Nuitka, which is an unrestricted compiler, I believe:
> http://nuitka.net/pages/overview.html

Not to forget Cython, which is the only Python-to-C compiler that is in
widespread use.


> Is this a completely independent project, or are there plans to
> leverage off of PyPy's toolchain, for example?

>From a look at the source code, it seems hard to bring it together with
anything. It looks very monolithic.

Stefan


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


Re: Is Python a commercial proposition ?

2012-07-30 Thread Stefan Behnel
Paul Rubin, 31.07.2012 06:45:
> A real compiler (PyPy) will help Python performance far more than
> multi-core currently can.

That's too general a statement to be meaningful.

Stefan


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


Re: [Python] Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Dieter Maurer
Chris Gonnerman  writes:

> On 07/30/2012 04:20 AM, Dieter Maurer wrote:
> ...
>> I find it very stupid to see several window scrolls of changes for
>> a package but to learn how to install the package, I have to download its
>> source...
> Not sure I get this.  The installation procedure for PollyReports is
> the same as for, what, 99% of Python source packages?
>
> sudo python setup.py install
>
> What else are you saying I should do?

This remark was not targeted at "PollyReports" but (in general) at packages
with non-trivial installation procedures which nevertheless
state on the overview page "for installation
read the separate installation instructions (in the source distribution)".

As a side note: playing well with python package managers
("easy_install", "pip", "zc.buildout", ...) could make it even
simpler than "sudo python setup.py install".

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


Re: OT: accessibility (was "Re: simplified Python parsing question")

2012-07-30 Thread Ian Kelly
On Mon, Jul 30, 2012 at 8:54 PM, Tim Chase
 wrote:
> I've tried a similar experiment and am curious on your input device.
>  Eye-tracking/dwell-clicking?  A sip/puff joystick?  Of the various
> input methods I tried, I found that Dasher[1] was the most
> intuitive, had a fairly high input rate and accuracy (both
> initially, and in terms of correcting mistakes I'd made).  It also
> had the ability to generate dictionaries/vocabularies that made more
> appropriate/weighted suggestions which might help in certain
> contexts (e.g. pre-load a Python grammar allowing for choosing full
> atoms in a given context).

A microphone with voice recognition software is described in the storyboard.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-30 Thread Steven D'Aprano
On Mon, 30 Jul 2012 21:45:51 -0700, Paul Rubin wrote:

> Steven D'Aprano  writes:
>> And at that level, you aren't going to write your app in Python anyway,
>> and not because of the GIL. (These microcontrollers are unlikely to
>> have multiple cores -- why the hell does your microwave oven need two
>> cores?)
> 
> http://greenarrays.com ;-)
> 
>> It seems to me that those who claim that the GIL is a serious barrier
>> to Python's use in the enterprise are mostly cargo-cult programmers,
> 
> I would say, it puts a crimp into Python's versatility but there are
> still lots of areas where it's not a serious issue.

Of course it's a crimp. Nobody likes the GIL for its own sake, and nobody 
likes the fact that it does slow CPython down under some circumstances. 
It's not like the Python devs scheme behind closed doors on how to make 
Python slower. If somebody came up with a way to remove the GIL without 
the harmful side-effects, or volunteered to do the enormous amount of 
work needed, the devs would be as enthusiastic for it as anyone else.

Recognising that there are *some* applications where Python isn't 
suitable (for whatever reason, not just because of the GIL) is simply 
common sense. There are a whole lot of factors leading to the choice of a 
compiler. "Can use all available cores on a CPU" is only one of many.

[rant]
But to hear some people talk, CPU-bound multi-threaded apps are the only 
"serious" enterprise apps, and further more, there is no possible way to 
make a program fast enough *except* threads, hence no possible way that 
Python is suitable except by removing the GIL.

Do they consider that perhaps there are alternatives to threads? Or that 
there already are Python implementations that don't include the GIL, 
running on big enterprise-friendly platforms like Java and .NET? No they 
do not. If Python didn't have the GIL, they'd find some other excuse to 
dismiss it for "serious" work.

And that is why I consider that anyone repeating without nuance the 
canard that the GIL makes Python unsuitable for serious enterprise work 
is a cargo-cultist.
[/rant]

And now I have to go yell at some kids who are on my lawn.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


on django deployment

2012-07-30 Thread Yzr
Hi, guys:
 which solution is better, concerning memory usage and concurrency
when deploying django ?
 1)  nginx + uWSGI + django
 2)  nginx + tornado + django

thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list