Re: What does "shell introspection" mean?

2011-06-26 Thread Thomas 'PointedEars' Lahn
Juan Kinunt wrote:

> In the PyDev installation documentation you see this sentence:
> 
> "The Forced builtin libs are the libraries that are built-in the
> interpreter, such as __builtin__, sha, etc or libraries that should
> forcefully analyzed through shell introspection (the other option to
> analyze modules with too much runtime information is providing
> Predefined Completions)."
> 
> What does "shell introspection" mean? And what do you think the writer
> want to say with "too much runtime information"?

Seriously, please ask the author, Fabio Zadrozny, instead (and report back 
here); as I recall he is quite communicative.  There is not much point in 
guessing about what is not even correct or coherent English, which stems 
from the fact that English is not Fabio's native language.

-- 
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 3 syntax error question

2011-06-26 Thread rzed
I've tried to install PySVG in a Python 3 setting, and I get a few 
errors on the build. Most are easy to fix, but this one I can't 
explain or fix:


Traceback (most recent call last):
  File "", line 1, in 
  File "builders.py", line 12, in 
from pysvg.shape import *
  File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
def moveToPoint(self,(x,y)):
 ^
SyntaxError: invalid syntax 


The moveToPoint method occurs three times in the file, with identical 
signatures. The other two are not showing up as errors, though since 
they occur later in the file, that may not be indicative. 

I don't see anything erroneous in this line. The syntax error often 
comes from the previous line, but I've moved this method around and 
it has always failed on this line and no other, regardless of what 
went before. 

I'm new to Py3, so maybe there's some obvious thing I'm not seeing 
here. Does anyone have any suggestions?

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


Re: Python 3 syntax error question

2011-06-26 Thread steve+comp . lang . python
rzed wrote:

> I've tried to install PySVG in a Python 3 setting, and I get a few
> errors on the build. Most are easy to fix, but this one I can't
> explain or fix:
> 
> 
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "builders.py", line 12, in 
> from pysvg.shape import *
>   File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
> def moveToPoint(self,(x,y)):
>  ^
> SyntaxError: invalid syntax
> 

Function signatures with automatic tuple-unpacking are no longer allowed in
Python3. So functions or methods like this:

def moveToPoint(self,(x,y)):

have to be re-written with the tuple unpacking moved into the body of the
function, e.g. something like this:

def moveToPoint(self, x_y):
x, y = x_y


Are you aware that you're trying to install a Python2 library under Python3?


-- 
Steven

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


Re: Python 3 syntax error question

2011-06-26 Thread Peter Otten
rzed wrote:

> I've tried to install PySVG in a Python 3 setting, and I get a few
> errors on the build. Most are easy to fix, but this one I can't
> explain or fix:
> 
> 
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "builders.py", line 12, in 
> from pysvg.shape import *
>   File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
> def moveToPoint(self,(x,y)):
>  ^
> SyntaxError: invalid syntax
> 
> 
> The moveToPoint method occurs three times in the file, with identical
> signatures. The other two are not showing up as errors, though since
> they occur later in the file, that may not be indicative.
> 
> I don't see anything erroneous in this line. The syntax error often
> comes from the previous line, but I've moved this method around and
> it has always failed on this line and no other, regardless of what
> went before.
> 
> I'm new to Py3, so maybe there's some obvious thing I'm not seeing
> here. Does anyone have any suggestions?
> 

Quoting

http://docs.python.org/dev/py3k/whatsnew/3.0.html#removed-syntax

"""
You can no longer write def foo(a, (b, c)):  Use def foo(a, b_c): b, c = 
b_c instead.
"""

If there isn't a Python 3 version of PySVG you can try to run it through

http://docs.python.org/dev/py3k/library/2to3.html#to3-reference

to make the easy changes.

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


Re: Python 3 syntax error question

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 2:04 PM, rzed  wrote:
> I've tried to install PySVG in a Python 3 setting, and I get a few
> errors on the build. Most are easy to fix, but this one I can't
> explain or fix:
>
> 
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "builders.py", line 12, in 
>    from pysvg.shape import *
>  File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
>    def moveToPoint(self,(x,y)):
>                         ^
> SyntaxError: invalid syntax
> 
>
> The moveToPoint method occurs three times in the file, with identical
> signatures. The other two are not showing up as errors, though since
> they occur later in the file, that may not be indicative.
>
> I don't see anything erroneous in this line. The syntax error often
> comes from the previous line, but I've moved this method around and
> it has always failed on this line and no other, regardless of what
> went before.
>
> I'm new to Py3, so maybe there's some obvious thing I'm not seeing
> here. Does anyone have any suggestions?

Did you run it through 2to3? When I run
def a(b, (c,d)):
pass
through 2to3, it tells me what I need to change.

-def a(b, (c,d)):
+def a(b, xxx_todo_changeme):
+(c,d) = xxx_todo_changeme

(which is what Steven said)

If you haven't used 2to3, I suggest you use it.

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


Re: Python 3 syntax error question

2011-06-26 Thread rzed
steve+comp.lang.pyt...@pearwood.info wrote in
news:4e074768$0$29982$c3e8da3$54964...@news.astraweb.com: 

> rzed wrote:
> 
>> I've tried to install PySVG in a Python 3 setting, and I get a
>> few errors on the build. Most are easy to fix, but this one I
>> can't explain or fix:
>> 
>> 
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "builders.py", line 12, in 
>> from pysvg.shape import *
>>   File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
>> def moveToPoint(self,(x,y)):
>>  ^
>> SyntaxError: invalid syntax
>> 
> 
> Function signatures with automatic tuple-unpacking are no longer
> allowed in Python3. So functions or methods like this:
> 
> def moveToPoint(self,(x,y)):
> 
> have to be re-written with the tuple unpacking moved into the
> body of the function, e.g. something like this:
> 
> def moveToPoint(self, x_y):
> x, y = x_y
> 
> 
> Are you aware that you're trying to install a Python2 library
> under Python3? 
> 
> 

Thank you all for your responses. Yes, I am aware of the version 
difference, but not of all the implications of that. I will run this 
through 2to3, but even without doing that, there are only about four 
syntax errors, and the others were obvious and easily corrected. 

There does not seem to be a Py3 version of this package. I was hoping 
to try it to see what broke. Well, I found out at least part of that, 
didn't I?

I was not aware of the removal of tuple-unpacking. I expect there was 
some extensive conversation about that. 

As to 2to3, I have to say that:

-def a(b, (c,d)):
+def a(b, xxx_todo_changeme):
+(c,d) = xxx_todo_changeme

... is not terribly revealing if one is unaware of what about it 
needs changing. I know, I know: RTFM

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


Re: Python 3 syntax error question

2011-06-26 Thread Chris Angelico
On Mon, Jun 27, 2011 at 1:28 AM, rzed  wrote:
> As to 2to3, I have to say that:
>
> -def a(b, (c,d)):
> +def a(b, xxx_todo_changeme):
> +    (c,d) = xxx_todo_changeme
>
> ... is not terribly revealing if one is unaware of what about it
> needs changing. I know, I know: RTFM

Sure, but you don't _have_ to look at the diff. Just run it through
2to3 and see how it runs. Never know, it might work direct out of the
box!

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


Re: Python 3 syntax error question

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 4:28 PM, rzed  wrote:
> steve+comp.lang.pyt...@pearwood.info wrote in
> news:4e074768$0$29982$c3e8da3$54964...@news.astraweb.com:
>
>> rzed wrote:
>>
>>> I've tried to install PySVG in a Python 3 setting, and I get a
>>> few errors on the build. Most are easy to fix, but this one I
>>> can't explain or fix:
>>>
>>> 
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File "builders.py", line 12, in 
>>>     from pysvg.shape import *
>>>   File "C:\Python32\lib\site-packages\pysvg\shape.py", line 91
>>>     def moveToPoint(self,(x,y)):
>>>                          ^
>>> SyntaxError: invalid syntax
>>> 
>>
>> Function signatures with automatic tuple-unpacking are no longer
>> allowed in Python3. So functions or methods like this:
>>
>> def moveToPoint(self,(x,y)):
>>
>> have to be re-written with the tuple unpacking moved into the
>> body of the function, e.g. something like this:
>>
>> def moveToPoint(self, x_y):
>>     x, y = x_y
>>
>>
>> Are you aware that you're trying to install a Python2 library
>> under Python3?
>>
>>
>
> Thank you all for your responses. Yes, I am aware of the version
> difference, but not of all the implications of that. I will run this
> through 2to3, but even without doing that, there are only about four
> syntax errors, and the others were obvious and easily corrected.
>
> There does not seem to be a Py3 version of this package. I was hoping
> to try it to see what broke. Well, I found out at least part of that,
> didn't I?
>
> I was not aware of the removal of tuple-unpacking. I expect there was
> some extensive conversation about that.
>
> As to 2to3, I have to say that:
>
> -def a(b, (c,d)):
> +def a(b, xxx_todo_changeme):
> +    (c,d) = xxx_todo_changeme
>
> ... is not terribly revealing if one is unaware of what about it
> needs changing. I know, I know: RTFM

It means delete every line with a '-' and replace them with those next
to the '+'
Of course, if you read the doc, it'll give you lots of different
options, including writing to the file, so all you need to do is
change the variable names.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Bluetooth

2011-06-26 Thread Valentin de Pablo Fouce
Hi all,

I'm looking for developing a bluetooth application in python, and I'm
looking for the most suitable python library for it. Googling some
time I found pyBluez (http://code.google.com/p/pybluez/), however, the
library seems to be stopped since end 2009 (latest update Nov 2009)
and not to many work since then. Is there any other library?

Has anybody any advice about it?

For me, the key is to develop in bluetooth, so I'm flexible in
programming language, although I'd like to go on python.

Thanks for your help,

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


Re: Significant figures calculation

2011-06-26 Thread Harold
> >I'm curious.  Is there a way to get the number of significant digits
> >for a particular Decimal instance?
>
> Yes:
>
> def sigdig(x):
>     "return the number of significant digits in x"
>     return len(x.as_tuple()[1])

Great! that's exactly what I needed.
thanks Chris!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NEED HELP-process words in a text file

2011-06-26 Thread Cousin Stanley

Steven D'Aprano wrote:

> If ONE word in uppercase is read in a SLIGHTLY louder voice, 
> then naturally it doesn't take much imagination TO READ 
> EVEN QUITE SHORT PASSAGES OF UNINTERRUPTED UPPERCASE WORDS 
> AS SHOUTING LOUDLY -- 

  And it doesn't take much of a reality check
  through my own personal faculties to realize 
  that my newsreader is not currently piped
  into a text-to-speech process and is not
  emitting any sound  :-)

  Even then, there most likely wouldn't be 
  any extra emphasis on words written 
  in all capital letters unless the tts process
  was specifically altered to do so  

> regardless of the poor design of programming languages 
> in the 60s and 70s.

  I don't think programming languages of that era
  were poorly designed and especially not just because
  they happened to be coded in text with all caps  


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

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


Re: Python 3 syntax error question

2011-06-26 Thread Jerry Hill
On Sun, Jun 26, 2011 at 11:31 AM, Chris Angelico  wrote:
> Sure, but you don't _have_ to look at the diff. Just run it through
> 2to3 and see how it runs. Never know, it might work direct out of the
> box!

This has been my experience, by the way.  I've used a few small pure
python libraries written for python 2.x that don't have 3.x versions,
and they've all worked just fine with just a quick run through the
2to3 process.  I can't speak for larger libraries, or ones with lots
of compiled code, but my experience with 2to3 has been great.

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


Re: Python Bluetooth

2011-06-26 Thread Bastian Ballmann
Hi,

you can have a look at http://lightblue.sourceforge.net/ but it also
seems to be unactive since end of 2009. 

If you really need a lib thats still under active development and you
dont want to switch to C maybe
http://sourceforge.net/projects/javabluetooth/ together with Jython is
an option?

HTH && Greets

Basti


Am Sun, 26 Jun 2011 08:32:27 -0700 (PDT)
schrieb Valentin de Pablo Fouce :

> Hi all,
> 
> I'm looking for developing a bluetooth application in python, and I'm
> looking for the most suitable python library for it. Googling some
> time I found pyBluez (http://code.google.com/p/pybluez/), however, the
> library seems to be stopped since end 2009 (latest update Nov 2009)
> and not to many work since then. Is there any other library?
> 
> Has anybody any advice about it?
> 
> For me, the key is to develop in bluetooth, so I'm flexible in
> programming language, although I'd like to go on python.
> 
> Thanks for your help,
> 
> Valentin



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


Re: Python 3 syntax error question

2011-06-26 Thread Terry Reedy

On 6/26/2011 11:28 AM, rzed wrote:

steve+comp.lang.pyt...@pearwood.info wrote in



Are you aware that you're trying to install a Python2 library
under Python3?



Thank you all for your responses. Yes, I am aware of the version
difference, but not of all the implications of that. I will run this
through 2to3, but even without doing that, there are only about four
syntax errors, and the others were obvious and easily corrected.


When you are done, I hope you feed results back to author as to how to 
make code run under Py3 without change (the explicit unpacking needed 
for Py3 works in Py2 also) or without further change after 2to3. Then 
encourage author to advertise fact and add Py3 classifier if listed in PyPI.


--
Terry Jan Reedy

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


Re: Python Bluetooth

2011-06-26 Thread Terry Reedy

On 6/26/2011 1:07 PM, Bastian Ballmann wrote:


you can have a look at http://lightblue.sourceforge.net/ but it also
seems to be unactive since end of 2009.



schrieb Valentin de Pablo Fouce:



I'm looking for developing a bluetooth application in python, and I'm
looking for the most suitable python library for it. Googling some
time I found pyBluez (http://code.google.com/p/pybluez/), however, the
library seems to be stopped since end 2009 (latest update Nov 2009)
and not to many work since then. Is there any other library?


Were these libraries abandoned incomplete or just finished? Has the 
bluetooth spec changed since then?


--
Terry Jan Reedy

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


can I package a distutil based python app in deb?

2011-06-26 Thread hackingKK

Hello all,
I guess the subject line says it all.
I want to package a python app to deb.
I have 3 interesting issues with it.
1, I would want it to run on Ubuntu 10.04, Ubuntu 10.10, Ubuntu 11.04 
and Debian 5.
2, the package depends on another python package which is also distutil 
based.

3, The second package needs to run in a virtual environment.
This means that I not only have to figure out the dependencies but also 
have the deb to include a script to get the virtual environment script, 
then create one for the package, then download all dependencies (Pylons 
0.9.7 in this case along with report lab) and finally put the package 
into this virtual environment.

Is this all possible?
Happy hacking.
Krishnakant.

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


Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Marc Aymerich
Hi,
I'm trying to define a function that has an optional parameter which
should be an empty list whenever it isn't given. However, it takes as
value the same value as the last time the function was executed. What
is the reason of this behaviour? How does python deal with default
values (i.e. when are they assigned/created)?

Thanks :)

>>> def a(foo=[]):
...  foo.append(1)
...  print foo
...
>>> a()
[1]
>>> a()
[1, 1]
>>> a()
[1, 1, 1]
>>> a()
[1, 1, 1, 1]
>>> a()
[1, 1, 1, 1, 1]
>>> a()
[1, 1, 1, 1, 1, 1]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Shashank Singh
On Sun, Jun 26, 2011 at 11:58 PM, Marc Aymerich  wrote:
> Hi,
> I'm trying to define a function that has an optional parameter which
> should be an empty list whenever it isn't given. However, it takes as
> value the same value as the last time the function was executed. What
> is the reason of this behaviour? How does python deal with default
> values (i.e. when are they assigned/created)?

This has been discussed before in this list, quite a few times
http://mail.python.org/pipermail/python-list/2010-March/1239044.html

A solution is to accept default value as None assign to [] by checking
for None inside the function

def f(a=None):
  if a is None: a = []



-- 
Regards
Shashank Singh
http://rationalpie.wordpress.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Bluetooth

2011-06-26 Thread Bastian Ballmann
Hi,

Am Sun, 26 Jun 2011 13:37:50 -0400
schrieb Terry Reedy :

> Were these libraries abandoned incomplete or just finished? Has the 
> bluetooth spec changed since then?
> 

They're definetly incomplete, but i would say the most important /
commonly used apis are implemented.

The Bluetooth spec added a low energy protocol stack since than in
version 4.0, but I dont have any experiences in that.

Greets

Basti


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


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Corey Richardson
Excerpts from Marc Aymerich's message of Sun Jun 26 14:28:30 -0400 2011:
> Hi,
> I'm trying to define a function that has an optional parameter which
> should be an empty list whenever it isn't given. However, it takes as
> value the same value as the last time the function was executed. What
> is the reason of this behaviour? How does python deal with default
> values (i.e. when are they assigned/created)?
> 
> Thanks :)
> 

Really common mistake, I made it myself too. When Python evaluates the 
function, it sees the default parameter of `foo' as the new object you
create with []. It keeps that object around. The proper idiom instead of

> >>> def a(foo=[]):
> ...  foo.append(1)
> ...  print foo
> ...

is

def a(foo=None):
if foo is None:
foo = []
foo.append(1)
print foo
-- 
Corey Richardson
  "Those who deny freedom to others, deserve it not for themselves"
 -- Abraham Lincoln


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


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 7:28 PM, Marc Aymerich  wrote:
> Hi,
> I'm trying to define a function that has an optional parameter which
> should be an empty list whenever it isn't given. However, it takes as
> value the same value as the last time the function was executed. What
> is the reason of this behaviour? How does python deal with default
> values (i.e. when are they assigned/created)?
>
> Thanks :)
>
 def a(foo=[]):
> ...  foo.append(1)
> ...  print foo
> ...
 a()
> [1]
 a()
> [1, 1]
 a()
> [1, 1, 1]
 a()
> [1, 1, 1, 1]
 a()
> [1, 1, 1, 1, 1]
 a()
> [1, 1, 1, 1, 1, 1]

Your problem arises because lists are mutable. Because foo (by
default, initially) points to a given list, every time the function is
called, it uses the same list that foo was first pointed to, if the
default argument value is taken.
The way to fix this is to instead do -

def a(foo=None):
if foo is None:
foo = []
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Terry Reedy

On 6/26/2011 2:28 PM, Marc Aymerich wrote:

Hi,
I'm trying to define a function that has an optional parameter which
should be an empty list whenever it isn't given. However, it takes as
value the same value as the last time the function was executed. What
is the reason of this behaviour? How does python deal with default
values (i.e. when are they assigned/created)?


Our fine Language Reference. Compound Statements chapter, Function 
definitions section, says in bold type: "Default parameter values are 
evaluated when the function definition is executed. ". I presume the 
tutorial says this somewhere too. Read both, along with the first 5 
chanpter of the Library reference.


If you want code executed when you call the function, put it in the body 
that is executed when you call the function


def f(lst = None):
  if lst is None:
lst = []
...

--
Terry Jan Reedy

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


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Thomas L. Shinnick

At 01:39 PM 6/26/2011, Shashank Singh wrote:

On Sun, Jun 26, 2011 at 11:58 PM, Marc Aymerich  wrote:
> Hi,
> I'm trying to define a function that has an optional parameter which
> should be an empty list whenever it isn't given. However, it takes as
> value the same value as the last time the function was executed. What
> is the reason of this behaviour? How does python deal with default
> values (i.e. when are they assigned/created)?

This has been discussed before in this list, quite a few times
http://mail.python.org/pipermail/python-list/2010-March/1239044.html

A solution is to accept default value as None assign to [] by checking
for None inside the function

def f(a=None):
  if a is None: a = []


See reference manual section 7.6  "Function definitions" under the 
discussion subtitle "Default parameter values are evaluated when the 
function definition is executed. "


http://docs.python.org/reference/compound_stmts.html#function-definitions

Yes, this is discussed in many places and many times, but why isn't 
it in the Python FAQ?  Amazing, yes?



--
Regards
Shashank Singh
http://rationalpie.wordpress.com
--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Benjamin Kaplan
On Sun, Jun 26, 2011 at 11:28 AM, Marc Aymerich  wrote:
> Hi,
> I'm trying to define a function that has an optional parameter which
> should be an empty list whenever it isn't given. However, it takes as
> value the same value as the last time the function was executed. What
> is the reason of this behaviour? How does python deal with default
> values (i.e. when are they assigned/created)?
>
> Thanks :)
>

So the thing about Python is that you don't actually declare
functions. You create them. def is an executable statement that
creates a function object. Default arguments are part of the function
object, so they get evaluated when the function is created.

>>> foo
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'foo' is not defined
>>> def foo(a = []) :
... a.append(1)
...
>>> foo.func_defaults
([],)
>>> foo()
>>> foo.func_defaults
([1],)
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Corey Richardson
Excerpts from Thomas L. Shinnick's message of Sun Jun 26 14:53:21 -0400 2011:
> See reference manual section 7.6  "Function definitions" under the 
> discussion subtitle "Default parameter values are evaluated when the 
> function definition is executed. "
>  
> http://docs.python.org/reference/compound_stmts.html#function-definitions
> 
> Yes, this is discussed in many places and many times, but why isn't 
> it in the Python FAQ?  Amazing, yes?
> 

Well, to be fair, I don't think most people actually read the FAQ.
The FAQ does say:

"Default arguments can be used to determine values once, at compile
time instead of at run time. This can only be done for functions or
objects which will not be changed during program execution..."

And he did modify the list during program execution. However this
isn't exactly forthright if you aren't looking for it / know what
you're reading.  I don't think it should be spilled out in detail but
maybe a "there are some tricks involved with mutable default
arguments (for example a list).  Refer to the language reference
(LINK) for more details" would be useful.

But I'm not really certain that would make much of a difference.
I'll Cc this to d...@python.org.
-- 
Corey Richardson
  "Those who deny freedom to others, deserve it not for themselves"
 -- Abraham Lincoln


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


windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Gelonida

Hi,

What do I have to do under python windows to create a directory with all 
permissions, such, that new files / directories created below will 
inherit the permissions.



The reason I am asking is, that I'd like to create a directory structure 
where multiple users should be allowed to read / write / create files 
and directories.



Alternatively it would be even better to specify exactly which users 
should be allowed to access the directory tree.


I never used / modified Windows file permissions except once or twice 
via explorer. I'm thus a little shaky with Microsoft's file permissions.


Thanks in advance for your answer.

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


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Irmen de Jong
On 26-6-2011 22:57, Gelonida wrote:
> Hi,
> 
> What do I have to do under python windows to create a directory with all 
> permissions,
> such, that new files / directories created below will inherit the permissions.
> 
> 
> The reason I am asking is, that I'd like to create a directory structure 
> where multiple
> users should be allowed to read / write / create files and directories.

Isn't this the default when you create a new directoy in Windows? (unless you're
creating it in some location where access is restricted, for instance C:\ or 
c:\program
files).  I'd try os.mkdir first in any case and check if it does the job.


> Alternatively it would be even better to specify exactly which users should 
> be allowed
> to access the directory tree.

Sorry, can't help you with this. I guess you'll need to use the windows 
extensions for
Python here and deal with user accounts and ACL's.

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


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Gelonida

On 6/26/2011 11:24 PM, Irmen de Jong wrote:

On 26-6-2011 22:57, Gelonida wrote:

Hi,

What do I have to do under python windows to create a directory with all 
permissions,
such, that new files / directories created below will inherit the permissions.

The reason I am asking is, that I'd like to create a directory structure where 
multiple
users should be allowed to read / write / create files and directories.


Isn't this the default when you create a new directoy in Windows? (unless you're
creating it in some location where access is restricted, for instance C:\ or 
c:\program
files).  I'd try os.mkdir first in any case and check if it does the job.


Have to check when I'm back to the machine in question.

On this machine I used os.mkdir() / os.makedirs() and I had permission 
problems , but only on Windows7. This is why I was asking the question.


I expect, that the win32 libraries might have function calls allowing to 
control the permissions of a directory, but I am really bad with win32 
as I worked mostly with Linux or code, that was platform independent, 
which Windows file permission handling is not :-( .







Alternatively it would be even better to specify exactly which users should be 
allowed
to access the directory tree.


Sorry, can't help you with this. I guess you'll need to use the windows 
extensions for
Python here and deal with user accounts and ACL's.


Yep I'm afraid that's the way to go and where I hoped somebody would 
have a few tiny example lines or pointers to the functions in question 
to be used.




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


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Irmen de Jong
On 26-6-2011 23:53, Gelonida wrote:
> 
> Yep I'm afraid that's the way to go and where I hoped somebody would have a 
> few tiny
> example lines or pointers to the functions in question to be used.

Maybe this is a bit of a help:
http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html

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


Re: Significant figures calculation

2011-06-26 Thread Lalitha Prasad K
In numerical analysis there is this concept of machine zero, which is
computed like this:

e=1.0
while 1.0+e > 1.0:
e=e/2.0
print e

The number e will give you the precision of floating point numbers.

Lalitha Prasad

On Sun, Jun 26, 2011 at 9:05 PM, Harold  wrote:

> > >I'm curious.  Is there a way to get the number of significant digits
> > >for a particular Decimal instance?
> >
> > Yes:
> >
> > def sigdig(x):
> > "return the number of significant digits in x"
> > return len(x.as_tuple()[1])
>
> Great! that's exactly what I needed.
> thanks Chris!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Thorsten Kampe
* Gelonida (Sun, 26 Jun 2011 22:57:57 +0200)
> What do I have to do under python windows to create a directory with
> all permissions, such, that new files / directories created below will
> inherit the permissions.

Exactly nothing (except creating the directory, of course).

> The reason I am asking is, that I'd like to create a directory
> structure where multiple users should be allowed to read / write /
> create files and directories.
> 
> Alternatively it would be even better to specify exactly which users
> should be allowed to access the directory tree.
> 
> I never used / modified Windows file permissions except once or twice
> via explorer. I'm thus a little shaky with Microsoft's file
> permissions.

Microsoft's permission handling hasn't changed in the last eleven years. 
So you had a lot of time to learn about it. Do you see this "Learn about 
access control and permissions" link when you're in the security tab? 
Just click on it.

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


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Michel Claveau - MVP
Hi!

+1

Gelonida confuses "Windows permissions" and "NTFS's rights".
(too) Many Windows users are unfamiliar with Windows.

@-salutations
-- 
Michel Claveau

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


PyCon AU gender diversity grants for women in Python!

2011-06-26 Thread Timothy Robert Ansell
PyCon AU gender diversity grants for women in Python


PyCon AU is pleased to announce that it will be offering two gender
diversity delegate grants to women who wish to attend PyCon AU in
2011. These grants will *both* cover full registration costs; in
addition, one of the grants will cover up to $AUD500 of travel and
accommodation costs for a woman living outside of the Sydney region to
attend.

These grants aim to reduce the financial barriers to attending PyCon
AU 2011, by subsidising the registration and travel costs of people
from diverse groups, who contribute in important ways to the Python
community.

More information can be found at http://pycon-au.org/2011/grants/

Eligibility
---
In order to be eligible for one of the grants, you must be:
 * a woman, aged 18 or older
 * professional, hobbyist or student interested in, or currently
   working in Python-related fields or projects
 * planning to attend both days of PyCon AU 2011

In order to be eligible for the travel and accommodation grant, you
must additionally:
 * live further than 150 km from the conference venue.

(If you are unsure, please visit
 http://maps.google.com.au/maps/place?q=66+Goulburn+St,+Sydney,+NSW+2000
 and use the "Get Directions" link in the upper left-hand corner to
 calculate the driving distance from your place of residence to the venue.)

More information can be found at http://pycon-au.org/2011/grants/

Award Amount

Both selected grant recipients will receive a free Full registration
to PyCon AU (including a seat at the conference dinner on Saturday
night), worth $198.

In addition, the recipient of the travel and accommodation grant will
be reimbursed up to $500 in travel and accommodation costs.

More information can be found at http://pycon-au.org/2011/grants/

Timeline

Applications for the gender diversity delegates grants are open now,
and will close on **8th of July**. We will notify all successful
recipients of their award by **15th of July** so that you can have
ample time to complete your travel plans.

More information can be found at http://pycon-au.org/2011/grants/

Tim 'mithro' Ansell
PyConAU Organiser
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: windows 7 create directory with read write execute permission for everybody

2011-06-26 Thread Thorsten Kampe
* Gelonida (Sun, 26 Jun 2011 23:53:15 +0200)
> On this machine I used os.mkdir() / os.makedirs() and I had permission 
> problems , but only on Windows7.

Windows file permissions haven't changed since 1995. The only addition 
was dynamic inheritance support back in 2000.

> I expect, that the win32 libraries might have function calls allowing
> to control the permissions of a directory, but I am really bad with
> win32 as I worked mostly with Linux or code, that was platform
> independent, which Windows file permission handling is not :-( .

Even Linux file systems have ACL support. It's only that few people use 
it since application support is sparse. And it lacks (dynamic) 
inheritance which is so 1980s.

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


Re: Python Bluetooth

2011-06-26 Thread Daniel Kluev
On Mon, Jun 27, 2011 at 2:32 AM, Valentin de Pablo Fouce
 wrote:
> Hi all,
>
> I'm looking for developing a bluetooth application in python, and I'm
> looking for the most suitable python library for it. Googling some
> time I found pyBluez (http://code.google.com/p/pybluez/), however, the
> library seems to be stopped since end 2009 (latest update Nov 2009)
> and not to many work since then. Is there any other library?

blueman is written in python and works fine with latest bluez lib.
It uses dbus for interaction with bluez, you can try using their
wrapper for your own app.

-- 
With best regards,
Daniel Kluev
-- 
http://mail.python.org/mailman/listinfo/python-list