Re: Debugging memory leaks

2013-06-16 Thread dieter
Chris Angelico ros...@gmail.com writes:
 ...
 Right. Everything needs to be scaled. Everything needs to be in
 perspective. Losing 1 kilobit per day is indeed trivial; even losing
 one kilobyte per day, which is what I assume you meant :), isn't
 significant. But it's not usually per day, it's per leaking action.
 Suppose your web browser leaks 1024 usable bytes of RAM every HTTP
 request. Do you know how much that'll waste per day? CAN you know?

What I suggested to the original poster was that *he* checks
whether *his* server leaks a really significant amount of memory
-- and starts to try a (difficult) memory leak analysis only in this
case. If he can restart his server periodically, this may make
the analysis unnecessary.

I also reported that I have undertaken such an analysis several times and
what helped me in these cases. I know - by experience - how difficult 
those analysis are. And there have been cases, where I failed despite
much effort: the systems I work with are huge, consisting of
thousands of components, developed by various independent groups,
using different languages (Python, C, Java); each of those components
may leak memory; most components are foreign to me.
Surely, you understand that in such a context a server restart
in the night of a week end (leading to a service disruption of a
few seconds) seems an attractive alternative to trying to locate the leaks.

Things would change drastically if the leak is big enough to force a restart
every few hours. But big leaks are *much* easier to detect
and locate than small leaks.

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


Re: Memory usage steadily going up while pickling objects

2013-06-16 Thread dieter
Giorgos Tzampanakis giorgos.tzampana...@gmail.com writes:
 ...
 So it seems that the pickle module does keep some internal cache or
 something like that.

This is highly unlikely: the ZODB (Zope object database)
uses pickle (actually, it is cPickle, the C implementation
of the pickle module) for serialization. The ZODB is
used in long running Zope processes. Should pickling cause
significant memory leackage, this would have been observed
(and reported).

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Denis McMahon
On Sat, 15 Jun 2013 19:18:53 +0300, Nick the Gr33k wrote:

 In both situations we still have 2 memory units holding values, so hows
 that different?

Consider that each named variable is a pointer to a memory location that 
holds a value. This is one of the ways in that a typed compiled language 
and an untyped scripted language may differ in their treatment of data 
items (or variables).

Consider the following C and Python code:

C:

int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location identified 
by the variable b, then copies the value from the location pointed to 
by b into the location pointed to by a.

b is a pointer to a memory location containing the value 6
a is a pointer to another memory location also containing the value 6

Python:

b = 6
a = b

In Python, this first puts the value 6 in in a memory location and points 
b at that memory location, then makes a point to the same memory 
location as b points to.

b is a pointer to a memory location containing the value 6
a is a pointer to the same memory location

Do you understand the difference?

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Denis McMahon
On Sat, 15 Jun 2013 22:38:38 +0300, Nick the Gr33k wrote:

 PLEASE take a look, its not a huge code

First, you need to start writing your code to less than 80 columns if 
you're going to keep posting it to usenet. I'm sure I'm not the only 
person who can't be bothered to unwrap it.

Secondly, the code you posted only tells part of the story - it's 
obviously missing either relevant imports or defined functions or 
possibly both.

Third, it would help to see examples of (a) what you expect it to 
generate, and (b) what it actually generates. You obviously have a web 
server available to you - you could put both code (just append .txt to 
the filename) and screenshots from your browser there with no difficulty 
at all and just include links.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Nick the Gr33k

On 16/6/2013 9:32 πμ, Denis McMahon wrote:

On Sat, 15 Jun 2013 19:18:53 +0300, Nick the Gr33k wrote:


In both situations we still have 2 memory units holding values, so hows
that different?


Consider that each named variable is a pointer to a memory location that
holds a value. This is one of the ways in that a typed compiled language
and an untyped scripted language may differ in their treatment of data
items (or variables).

Consider the following C and Python code:

C:

int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location identified
by the variable b, then copies the value from the location pointed to
by b into the location pointed to by a.

b is a pointer to a memory location containing the value 6
a is a pointer to another memory location also containing the value 6

Python:

b = 6
a = b

In Python, this first puts the value 6 in in a memory location and points
b at that memory location, then makes a point to the same memory
location as b points to.

b is a pointer to a memory location containing the value 6
a is a pointer to the same memory location

Do you understand the difference?


Yes and thank you for explaining in detail to me.
So Python economies(saves) system's memory. Good job Python!

There is no point having 2 variables point to 2 different memory 
locations as C does since both of those memory locations are supposed to 
contain the same value!


One thing that i want you guys to confirm to me:

a and b in both of the languages mentioned are pointers to memory 
locations which hold a value.


A pointer = a variable that has as a value a memory address
a variable = a memory address that has as a value the actual value we 
want to store.


But since pointer itself is a memory location that holds as a value the 
address of another memory location(by definition) that in it's own turn 
holds the actual value we want stored?


So the scheme would look like this in Python:

memory address = number 6

memory address = memory address value that stores number 6 (pointer a)

memory address = memory address value that stores number 6 (pointer b)


So having in mind the above.

The memory address that actually stores number 6 have no name at all and 
the only way to access it's value is by printing the variables a or b? 
Doesn't that memory address have a name itself?


if someone wants the memory address of the pointer's a or b, how can he 
access it? in C it was somethign like a and b


And in Python internally shall i imagine two tables that has 
associations of:


variable's_name - memory_address - actual value

And ALL 3 of them are actually bits(1s and 0s)

Is this how the thing works?

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Nick the Gr33k

On 16/6/2013 4:55 πμ, Tim Roberts wrote:

Nick the Gr33k supp...@superhost.gr wrote:
Because Python lets you use arbitrary values in a Boolean context, the net
result is exactly the same.


What is an arbitrary value? don even knwo what arbitrary means literally 
in English.



In a long series separated by or, the expression is true as soon as one
of the subexpressions is true.  So, as a short-circuit, Python simply
returns the first one that has a true value.  So, for example, these all
return 'abcd':

 'abcd' or 'defg' or 'hjkl'   == 'abcd'
 0 or 'abcd' or 'defg' or 'hjkl'  == 'abcd'
 0 or None or 'abcd' or 'defg' or 'hjkl'  == 'abcd'

Similarly, and returns the first false value, or if they're all true,
the last value.  Why?  Because it can't know whether the whole expression
is true unless it looks at every value.  So:

 0 and 1 and 'what'   ==  0
 1 and 0 and 'what'   ==  0
 1 and None and 0 ==  None
 1 and 1 and 'what'   == 'what'


Thank you Tim.

I decided that it's better to thing it through as:

The argument being returned in an and or or expression is the one 
that *determined' the evaluation of the expression.


And actually what's being returned is not the argument itself but the 
argument's value.


--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Nick the Gr33k

On 16/6/2013 8:06 πμ, Steven D'Aprano wrote:

Nikos,

Have you considered subscribing to this?

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


Possibly some of these concepts will be easier for you to understand if
explained to you in your native language. Or you might be able to join a
local Users Group who can help you.


Thank you Steven i don't want to enter there as mail but wish to find it 
as a newsgroups, which i tried to subscribe but TB couldn't find it.


Also i have no trouble understand you guys in English or express myself 
here. I like English.


And i'm under the impression that foreigners are more helpful from 
Greeks. At least that's what experience have tought me in a local linux 
group for many years.


I prefer staying here but i can also subscribe there as well if you teel 
me what the groups name.


--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Nick the Gr33k

On 16/6/2013 10:23 πμ, Denis McMahon wrote:

On Sat, 15 Jun 2013 22:38:38 +0300, Nick the Gr33k wrote:


PLEASE take a look, its not a huge code


First, you need to start writing your code to less than 80 columns if
you're going to keep posting it to usenet. I'm sure I'm not the only
person who can't be bothered to unwrap it.


TB behaves for me the same way. Any line  80 chars gets a newline.
Why this is happening? Why not post up to 256 chars in a single line?


Secondly, the code you posted only tells part of the story - it's
obviously missing either relevant imports or defined functions or
possibly both.

Third, it would help to see examples of (a) what you expect it to
generate, and (b) what it actually generates. You obviously have a web
server available to you - you could put both code (just append .txt to
the filename) and screenshots from your browser there with no difficulty
at all and just include links.

Actually i twas a short story since i have asked this already in 2 
previous threads of mine,  but here it is the whole thing pasted in 
pastebin. Its not so biug and with your talent you could understand it 
in aprox. 5 mins.


http://pastebin.com/XgWKuXUC
--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Denis McMahon
On Sun, 16 Jun 2013 11:35:12 +0300, Nick the Gr33k wrote:

 TB behaves for me the same way. Any line  80 chars gets a newline. Why
 this is happening? Why not post up to 256 chars in a single line?

Because this is usenet. Read the RFCs if you must know!

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Terry Reedy

On 6/16/2013 1:29 AM, Chris Angelico wrote:

On Sun, Jun 16, 2013 at 3:20 PM, Steven D'Aprano



If you're bringing in the *entire* CPython code base, as shown here:

http://hg.python.org/


This is the python.org collection of repositories, not just cpython.


keep in mind that it includes the equivalent of four independent
implementations:

- CPython 2.x
- CPython 3.x



- Stackless
- Jython


Hrm. Why are there other Pythons in the cpython repository?


There are not. The cpython repository
http://hg.python.org/cpython/
only contains cpython. As I write, the last revision is 84110. Windows 
says that my cpython clone has about 1400 folders, 15000 files, and 500 
million bytes


--
Terry Jan Reedy

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Denis McMahon
On Sun, 16 Jun 2013 11:07:12 +0300, Nick the Gr33k wrote:

 On 16/6/2013 9:32 πμ, Denis McMahon wrote:
 On Sat, 15 Jun 2013 19:18:53 +0300, Nick the Gr33k wrote:

 In both situations we still have 2 memory units holding values, so
 hows that different?

 Consider that each named variable is a pointer to a memory location
 that holds a value. This is one of the ways in that a typed compiled
 language and an untyped scripted language may differ in their treatment
 of data items (or variables).

 Consider the following C and Python code:

 C:

 int a, b;
 b = 6;
 a = b;

 In C, this places the numeric value 6 into the memory location
 identified by the variable b, then copies the value from the location
 pointed to by b into the location pointed to by a.

 b is a pointer to a memory location containing the value 6 a is a
 pointer to another memory location also containing the value 6

 Python:

 b = 6
 a = b

 In Python, this first puts the value 6 in in a memory location and
 points b at that memory location, then makes a point to the same
 memory location as b points to.

 b is a pointer to a memory location containing the value 6 a is a
 pointer to the same memory location

 Do you understand the difference?

 Yes and thank you for explaining in detail to me.
 So Python economies(saves) system's memory. Good job Python!

No. Don't read that into it.

For example, in Python

a = 6
b = a
c = 6

a and b point to one memory location that contains the value 6
c points to a different memory location that contains the value 6

Python doesn't point all the variables that have the same value at the 
same location.

 A pointer = a variable that has as a value a memory address a variable =
 a memory address that has as a value the actual value we want to store.

These are really C terms, not Python terms. Stop thinking that C is 
behaving like Python.

 Is this how the thing works?

No.

Python is an interpreted language. C is a compiled language. They present 
very different feature sets to the user. You need to understand this, and 
at the moment you're not doing so.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Chris Angelico
On Sun, Jun 16, 2013 at 7:15 PM, Terry Reedy tjre...@udel.edu wrote:
 On 6/16/2013 1:29 AM, Chris Angelico wrote:

 On Sun, Jun 16, 2013 at 3:20 PM, Steven D'Aprano
 keep in mind that it includes the equivalent of four independent
 implementations:

 - CPython 2.x
 - CPython 3.x


 - Stackless
 - Jython


 Hrm. Why are there other Pythons in the cpython repository?


 There are not. The cpython repository
 http://hg.python.org/cpython/
 only contains cpython. As I write, the last revision is 84110. Windows says
 that my cpython clone has about 1400 folders, 15000 files, and 500 million
 bytes

Ah, well it's this one that I have. So it should have only CPython in it.

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


Re: My son wants me to teach him Python

2013-06-16 Thread Cameron Simpson
On 14Jun2013 20:12, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
| [...] PowerShell has been
| available as a download on WinXP and standard on Win7 [PS 3 is a
| download for Win7, stock on real Win8].
|   While I'm not fluent in it, there are some commands I've gotten
| rather engrained...
| 
| get-childitem -recurse -filter *.ad* | select-string -pattern with
| 
| finds all the Ada (GNAT convention .ads/.adb) files containing with
| statements. And pattern probably is a regex so I could fine tune it to
| just the package withs by using a start of line marker...

Hmm.

  find . -name '*.ad*' | xargs grep with

on almost any UNIX system. There's any number of variations on that
depending on exactly what you want. I'm not going to get sucked
into a UNIX/Windows bickerfest here, but your PowerShell example
isn't winning me over. Sound like they reinvented the wheel. Again,
years later:-(

Cheers,
-- 
Cameron Simpson c...@zip.com.au

Those who do not understand Unix are condemned to reinvent it, poorly.
- Henry Spencer @ U of Toronto Zoology, he...@zoo.toronto.edu
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Nick the Gr33k

On 16/6/2013 12:22 μμ, Denis McMahon wrote:

On Sun, 16 Jun 2013 11:07:12 +0300, Nick the Gr33k wrote:


On 16/6/2013 9:32 πμ, Denis McMahon wrote:

On Sat, 15 Jun 2013 19:18:53 +0300, Nick the Gr33k wrote:


In both situations we still have 2 memory units holding values, so
hows that different?


Consider that each named variable is a pointer to a memory location
that holds a value. This is one of the ways in that a typed compiled
language and an untyped scripted language may differ in their treatment
of data items (or variables).

Consider the following C and Python code:

C:

int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location
identified by the variable b, then copies the value from the location
pointed to by b into the location pointed to by a.

b is a pointer to a memory location containing the value 6 a is a
pointer to another memory location also containing the value 6

Python:

b = 6
a = b

In Python, this first puts the value 6 in in a memory location and
points b at that memory location, then makes a point to the same
memory location as b points to.

b is a pointer to a memory location containing the value 6 a is a
pointer to the same memory location

Do you understand the difference?


Yes and thank you for explaining in detail to me.
So Python economies(saves) system's memory. Good job Python!


No. Don't read that into it.

For example, in Python

a = 6
b = a
c = 6

a and b point to one memory location that contains the value 6
c points to a different memory location that contains the value 6


I believe you are mistaken.

a here is not a pointer but variable,
which is a memory location that stores value 6.

b here is a pointer. It's value is the memory location of variable a 
which stores value 6.


c here is just te same as a , a variable.


A pointer = a variable that has as a value a memory address a variable =
a memory address that has as a value the actual value we want to store.


These are really C terms, not Python terms. Stop thinking that C is
behaving like Python.



I think it behaves the same way, but lets here from someone else too.


Is this how the thing works?


No.

Python is an interpreted language. C is a compiled language. They present
very different feature sets to the user. You need to understand this, and
at the moment you're not doing so.


Whats the difference of interpreting  to compiling ?

I have also asked other things too which you didn't quote, please do.

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 11:28:00 +0300, Nick the Gr33k wrote:

 On 16/6/2013 8:06 πμ, Steven D'Aprano wrote:
 Nikos,

 Have you considered subscribing to this?

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

[...]
 I prefer staying here but i can also subscribe there as well if you teel
 me what the groups name.

Nikos, this is exactly the sort of thing that makes it painful to try to 
help you. I've given you the URL. The name of the list is in the URL, and 
even if it isn't, you can just click on it and see for yourself.

Let me repeat the URL in case you cannot see it above:

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

I will not answer any more questions about the python-greece list, 
because I do not know any more about it than what you can see by 
following that list.



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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread R. Michael Weylandt
On Sun, Jun 16, 2013 at 10:59 AM, Nick the Gr33k supp...@superhost.gr wrote:
 On 16/6/2013 12:22 μμ, Denis McMahon wrote:

 For example, in Python

 a = 6
 b = a
 c = 6

 a and b point to one memory location that contains the value 6
 c points to a different memory location that contains the value 6


 I believe you are mistaken.

 a here is not a pointer but variable,
 which is a memory location that stores value 6.

 b here is a pointer. It's value is the memory location of variable a which
 stores value 6.

 c here is just te same as a , a variable.

Actually, y'all both might be. This is a bit CPython specific and not
mandated by the language specification.

To Nikos: please don't extrapolate from the examples below. They are a
CPython (the most common implementation of the Python language)
specific detail.

## CODE SNIPPET##
a = 6; b = a; c = 6

id(a)
id(b)
id(c)
## END CODE##

These are all the same, indicating that they all point to the same 6
in memory. That's a CPython specific optimization (caching small
integers) which is not guaranteed by the language and changes between
pythons and between compiles.

For example,

## CODE SNIPPET##
a = 552315251254
b = a
c =  552315251254

a is b # True _on my machine_
a is c # False _on my machine_

id(a)
id(b)
id(c)
## END CODE##

Note that to compare if two names point to the same object, you can
use the is operator.

a is b
c is a

etc.


 A pointer = a variable that has as a value a memory address a variable =
 a memory address that has as a value the actual value we want to store.


 These are really C terms, not Python terms. Stop thinking that C is
 behaving like Python.



 I think it behaves the same way, but lets here from someone else too.

I understand the Greeks invented democracy and all that, but facts
aren't subject to it.


 Whats the difference of interpreting  to compiling ?

If only it could be googled Alas, no one has ever written anything
about technology on the internet. Ironic that...

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Mark Lawrence

On 16/06/2013 11:42, R. Michael Weylandt wrote:




Whats the difference of interpreting  to compiling ?


If only it could be googled Alas, no one has ever written anything
about technology on the internet. Ironic that...

Michael



I'm very sorry but I don't understand the words googled and 
internet.  Could you please explain them?


--
Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green. Snooker 
commentator 'Whispering' Ted Lowe.


Mark Lawrence

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Denis McMahon
On Sun, 16 Jun 2013 12:59:00 +0300, Nick the Gr33k wrote:

 Whats the difference of interpreting  to compiling ?

OK, I give up!

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 1:33 μμ, Steven D'Aprano wrote:

On Sun, 16 Jun 2013 11:28:00 +0300, Nick the Gr33k wrote:


On 16/6/2013 8:06 πμ, Steven D'Aprano wrote:

Nikos,

Have you considered subscribing to this?

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


[...]

I prefer staying here but i can also subscribe there as well if you teel
me what the groups name.


Nikos, this is exactly the sort of thing that makes it painful to try to
help you. I've given you the URL. The name of the list is in the URL, and
even if it isn't, you can just click on it and see for yourself.

Let me repeat the URL in case you cannot see it above:

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

I will not answer any more questions about the python-greece list,
because I do not know any more about it than what you can see by
following that list.




i did Steven that why i asked in the 1st place

To post a message to all the list members, send email to 
python-gre...@python.org.


this is not a valid nrewgroup name/

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Chris “Kwpolska” Warrick
On Sun, Jun 16, 2013 at 12:33 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:

 On Sun, 16 Jun 2013 11:28:00 +0300, Nick the Gr33k wrote:

  On 16/6/2013 8:06 πμ, Steven D'Aprano wrote:
  Nikos,
 
  Have you considered subscribing to this?
 
  http://mail.python.org/mailman/listinfo/python-greece

 [...]
  I prefer staying here but i can also subscribe there as well if you teel
  me what the groups name.

 Nikos, this is exactly the sort of thing that makes it painful to try to
 help you. I've given you the URL. The name of the list is in the URL, and
 even if it isn't, you can just click on it and see for yourself.

 Let me repeat the URL in case you cannot see it above:

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

Nikos wants Usenet:

 Thank you Steven i don't want to enter there as mail but wish to find it as a 
 newsgroups, which i tried to subscribe but TB couldn't find it.

--
Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Mark Lawrence

On 16/06/2013 11:57, Ferrous Cranus wrote:

i did Steven that why i asked in the 1st place

To post a message to all the list members, send email to
python-gre...@python.org.

this is not a valid nrewgroup name/



Not valid in the same way that supp...@superhost.gr is not valid?

--
Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green. Snooker 
commentator 'Whispering' Ted Lowe.


Mark Lawrence

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 1:42 μμ, R. Michael Weylandt wrote:


I believe you are mistaken.

a here is not a pointer but variable,
which is a memory location that stores value 6.

b here is a pointer. It's value is the memory location of variable a which
stores value 6.

c here is just te same as a , a variable.

Actually, y'all both might be. This is a bit CPython specific and not
mandated by the language specification.

To Nikos: please don't extrapolate from the examples below. They are a
CPython (the most common implementation of the Python language)
specific detail.

## CODE SNIPPET##
a = 6; b = a; c = 6

id(a)
id(b)
id(c)
## END CODE##

These are all the same, indicating that they all point to the same 6
in memory. That's a CPython specific optimization (caching small
integers) which is not guaranteed by the language and changes between
pythons and between compiles.

For example,

## CODE SNIPPET##
a = 552315251254
b = a
c =  552315251254

a is b # True _on my machine_


I accept this if in the premise that, b boils down to actually point to 
a's value, but it has to go through a first to find it, not directly.



a is c # False _on my machine_


Why false?  These are 2 different memory locations storing the same number.
This should have been True.

Looks very weird.

a = memory location storing a value
b = memory location storing a's memory location
c = memory location storing a value, the same value as a


id(a)
id(b)
id(c)
## END CODE##

Note that to compare if two names point to the same object, you can
use the is operator.

a is b
c is a

etc.


what id() does, never heard of that function before.



--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 2:09 μμ, Mark Lawrence wrote:

On 16/06/2013 11:57, Ferrous Cranus wrote:

i did Steven that why i asked in the 1st place

To post a message to all the list members, send email to
python-gre...@python.org.

this is not a valid nrewgroup name/



Not valid in the same way that supp...@superhost.gr is not valid?


There is not newsgroup called 'python-greece'. i searched.

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


OT: C vs Python terminology (was: A certainl part of an if() structure never gets executed)

2013-06-16 Thread Andreas Perstinger

On 16.06.2013 08:32, Denis McMahon wrote:

C:

int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location identified
by the variable b,


so far so good.


then copies the value from the location pointed to by b into the
location pointed to by a.


Wrong. Neither a nor b are pointers, thus they don't point to a 
memory location.

This part should be written as
then copies the value at the location identified by b to the location 
identified by a.



b is a pointer to a memory location containing the value 6

 a is a pointer to another memory location also containing the value 6

Again, neither a nor b are pointers.
b is the name of a memory location containing the integer value 6.
a is the name of another memory location containing the integer value 6.


Python:

b = 6
a = b

In Python, this first puts the value 6 in in a memory location and points
b at that memory location, then makes a point to the same memory
location as b points to.

b is a pointer to a memory location containing the value 6
a is a pointer to the same memory location


I wouldn't use the term pointer in context with Python. Using the 
terms from the language reference I would write that as
In Python, this first creates an integer object with value 6 and then 
binds the name b to it. Then it binds the name a to the same object.
Thus both a and b reference the same object, i.e. they are different 
names for the same object.


Bye, Andreas
--
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Jussi Piitulainen
Nick the Gr33k writes:
 On 16/6/2013 12:22 μμ, Denis McMahon wrote:
  For example, in Python
 
  a = 6
  b = a
  c = 6
 
  a and b point to one memory location that contains the value 6
  c points to a different memory location that contains the value 6
 
 I believe you are mistaken.
 
 a here is not a pointer but variable,
 which is a memory location that stores value 6.
 
 b here is a pointer. It's value is the memory location of variable a
 which stores value 6.
 
 c here is just te same as a , a variable.

b is also just like a.

All the talk about pointers and memory locations is intended to
explain how things do or do not change. (Or, sometimes, how the
behaviour is implemented.)

If, instead of the above, you have

a = 6
b = a
b = 5

you will find that b == 5 and a == 6. So b is not the same as a. Else
one would have changed when the other changed. I would say that a and
b are different variables. They had the same value, briefly.

What does same mean? Think of mutable objects. A dictionary, for
example:

a = dict(x = 3)
b = a
b.update(x = 31)

You will find that the value of a changed when the value of b changed.
It's the same value. Values do not get copied in Python when you pass
them around. This is implemented with pointers and memory locations,
but in Python these implementation details are normally hidden behind
the scenes.

Python is far from unique in this regard.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Mark Lawrence

On 16/06/2013 12:06, Ferrous Cranus wrote:



what id() does, never heard of that function before.



what google does, never heard of that function before.

--
Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green. Snooker 
commentator 'Whispering' Ted Lowe.


Mark Lawrence

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


Re: Python Greek mailing list [was Re: Why 'files.py' does not print the filenames into a table format?]

2013-06-16 Thread Chris “Kwpolska” Warrick
On Sun, Jun 16, 2013 at 1:09 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 16/06/2013 11:57, Ferrous Cranus wrote:

 i did Steven that why i asked in the 1st place

 To post a message to all the list members, send email to
 python-gre...@python.org.

 this is not a valid nrewgroup name/


 Not valid in the same way that supp...@superhost.gr is not valid?

http://en.wikipedia.org/wiki/Usenet#Organization

--
Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread R. Michael Weylandt
On Sun, Jun 16, 2013 at 12:06 PM, Ferrous Cranus supp...@superhost.gr wrote:

I appreciate you've returned to your Ferrous Cranus persona for this
interchange. It reminds me not to get hung up on concerns of
futility...

 On 16/6/2013 1:42 μμ, R. Michael Weylandt wrote:


 ## CODE SNIPPET##
 a = 552315251254
 b = a
 c =  552315251254

 a is b # True _on my machine_


 I accept this if in the premise that, b boils down to actually point to a's
 value, but it has to go through a first to find it, not directly.

You don't get to accept it on a premise or not. It's simply a matter of fact.

In fact, b does not go through a. The memory address referenced
exists even if the a binding is removed using del a or some other
mechanism. Imagine this scenario:

[a]
\
 6
   /
[b]

Using the name a or b simply tells Python where to look for a
value, but the value itself is not associated with a or b and will
only be removed if both a and b are del'd.

If we remove a while keeping b alive, we still have a means of
getting to 6 so Python's GC / RefCounter won't remove it. This
implies that the memory can't be solely owned by a.

[a] # Binding gone now or perhaps referring to something else

 6
/
[b]

And this pattern continues for any sort of Python object.


 a is c # False _on my machine_


 Why false?  These are 2 different memory locations storing the same number.
 This should have been True.

Again, you have the idea that you can use words like should here. It
either is or isn't. There's simply no normative claim involved.


 what id() does, never heard of that function before.


It seems you've also never heard of Python's help function?

Try

help(id)

at your interactive prompt and see what happens.


 --
 What is now proved was at first only imagined!

Depth of stubbornness?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread YBM

Le 16.06.2013 13:06, Ferrous Cranus a écrit :

what id() does, never heard of that function before.


just type help(id) at Python prompt and stop flooding the group with
superfluous demands.



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


Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.]

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 10:51:31 +, Denis McMahon wrote:

 On Sun, 16 Jun 2013 12:59:00 +0300, Nick the Gr33k wrote:
 
 Whats the difference of interpreting  to compiling ?
 
 OK, I give up!

Actually, that's a more subtle question than most people think. Python, 
for example, is a compiled language. (What did you think the c in 
.pyc files stood for? and the compile() function?) It is compiled to 
byte-code, which runs on a virtual machine, rather than machine-code, 
which runs on a physical machine. Except PyPy, which *is* compiled to 
machine-code. Except that it doesn't do so at compile time, but on the 
fly at run-time.

And these days, for many types of hardware, even machine-code is often 
interpreted by a virtual machine on a chip. And even languages which 
compile to machine-code often use an intermediate platform-independent 
form rather than targeting pure machine-code. The line between compilers 
and interpreters is quite fuzzy.

Probably the best definition I've seen for the difference between a 
modern compiler and interpreter is this one:

...the distinguishing feature of interpreted languages is not that they 
are not compiled, but that the compiler is part of the language runtime 
and that, therefore, it is possible (and easy) to execute code generated 
on the fly.
-- Roberto Ierusalimschy, Programming In Lua, 2nd Edition, p. 63



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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 09:22:20 +, Denis McMahon wrote:

 Python:

 b = 6
 a = b

 In Python, this first puts the value 6 in in a memory location and
 points b at that memory location, then makes a point to the same
 memory location as b points to.

That may be true in some sense for CPython, the reference implementation, 
but it is not a promise of the language. For example, in PyPy objects are 
free to move around in memory, so you cannot meaningfully speak of 
putting 6 in a memory location or having a variable point to the same 
memory location.

The language promise is that the two names, a and b, both refer to 
the same object. In the same way that, depending on who you ask, Barack 
Obama, Mr President, and Dad are three names referring to the same 
person. Anything more than that depends on the implementation.


[...]
 For example, in Python
 
 a = 6
 b = a
 c = 6
 
 a and b point to one memory location that contains the value 6 c points
 to a different memory location that contains the value 6

Well, maybe it does, maybe it doesn't. This is one area where the 
language does not specify the underlying behaviour. Because ints are 
unchangeable, immutable objects, the implementation is free to cache and 
reuse them if it wants. CPython caches small integers, but not floats. 
Other implementations may cache fewer, or more, immutable objects.

One thing which no Python implementation can do though is re-use 
*mutable* objects.


[...]
 These are really C terms, not Python terms. Stop thinking that C is
 behaving like Python.

This is certainly true!


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


Re: OT: C vs Python terminology

2013-06-16 Thread Dave Angel

On 06/16/2013 07:22 AM, Andreas Perstinger wrote:

On 16.06.2013 08:32, Denis McMahon wrote:

C:

int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location identified
by the variable b,


so far so good.


then copies the value from the location pointed to by b into the
location pointed to by a.


Wrong. Neither a nor b are pointers, thus they don't point to a
memory location.
This part should be written as
then copies the value at the location identified by b to the location
identified by a.


But it doesn't.  It binds b to the same object to which a is currently 
bound.



b is a pointer to a memory location containing the value 6

  a is a pointer to another memory location also containing the value 6

Again, neither a nor b are pointers.
b is the name of a memory location containing the integer value 6.
a is the name of another memory location containing the integer value 6.



Not even close.  If you don't like the terms bound or points, the 
perhaps you'd be happy with b is the name that currently knows how to 
find an int object containing 6.  That object has no name, and never 
will.  And it can exist for a long time with no names directly bound to it.



Python:

b = 6
a = b

In Python, this first puts the value 6 in in a memory location and points
b at that memory location, then makes a point to the same memory
location as b points to.

b is a pointer to a memory location containing the value 6
a is a pointer to the same memory location


I wouldn't use the term pointer in context with Python. Using the
terms from the language reference I would write that as
In Python, this first creates an integer object with value 6 and then
binds the name b to it. Then it binds the name a to the same object.
Thus both a and b reference the same object, i.e. they are different
names for the same object.

Bye, Andreas


Doing all of this discussion with immutable objects masks the real 
behavior, as someone can use a false model and seem to justify that 
model.  I don't think you're doing that, but others in the thread are.


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


Re: Timsort in Cpython

2013-06-16 Thread mm0fmf

Answer: The lost context.

Question: What makes top-posted replies harder to read than bottom-posted?



alphons...@gmail.com wrote:

Yes I've read it. Very interesting read. There are other resources too online 
that make it very clear, for instance the wikipedia articles is pretty good.

Though, if anyone would be interested in helping me out further -- though by all means, I'm not lazy, I can figure it myself. But, I wanted to pass in variables into listsort and watch timsort work line by line in gdb. 


listsort(PyListObject *self, PyObject *args, PyObject *kwds)

I've never worked with Cpython source before, but it looks like PyObject is 
just some type of general strut.. I think anyway. How does python represent a 
list of ints in source? and what are the two second arguments for, assuming the 
first is the list strut.

On Saturday, June 15, 2013 12:44:01 PM UTC-7, alpho...@gmail.com wrote:

I'm currently trying to make sense of Python's Timsort function. From the 
wikipedia page I was told the algorithm is located somewhere here: 
http://hg.python.org/cpython/file/default/Objects/listobject.c



So of all the functions in there, could somebody point to me which one is 
timsort?



Thanks, if anyone can help.

Alphonse23

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


Re: Version Control Software

2013-06-16 Thread Chris “Kwpolska” Warrick
On Sun, Jun 16, 2013 at 1:14 AM, Chris Angelico ros...@gmail.com wrote:
 Hmm. ~/cpython/.hg is 200MB+, but ~/pike/.git is only 86MB. Does
 Mercurial compress its content? A tar.gz of each comes down, but only
 to ~170MB and ~75MB respectively, so I'm guessing the bulk of it is
 already compressed. But 200MB for cpython seems like a lot.

Next time, do a more fair comparison.

I created an empty git and hg repository, and created a file promptly
named “file” with DIGIT ONE (0x31; UTF-8/ASCII–encoded) and commited
it with “c1” as the message, then I turned it into “12” and commited
as “c2” and did this one more time, making the file “123” at commit
named “c3”.

[kwpolska@kwpolska-lin .hg@default]% cat * */* */*/* 2/dev/null | wc -c
1481
[kwpolska@kwpolska-lin .git@master]% cat * */* */*/* */*/*/* 2/dev/null | wc -c
16860 ← WRONG!

There is just one problem with this: an empty git repository starts at
15216 bytes, due to some sample hooks.  Let’s remove them and try
again:

[kwpolska@kwpolska-lin .git@master]% rm hooks/*
[kwpolska@kwpolska-lin .git@master]% cat * */* */*/* */*/*/* */*/*/*
2/dev/null | wc -c
2499

which is a much more sane number.  This includes a config file (in the
ini/configparser format) and such.  According to my maths skils (or
rather zsh’s skills), new commits are responsible for 1644 bytes in
the git repo and 1391 bytes in the hg repo.

(I’m using wc -c to count the bytes in all files there are.  du is
unaccurate with files smaller than 4096 bytes.)

--
Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 3:04 μμ, R. Michael Weylandt wrote:

On Sun, Jun 16, 2013 at 12:06 PM, Ferrous Cranus supp...@superhost.gr wrote:

I appreciate you've returned to your Ferrous Cranus persona for this
interchange. It reminds me not to get hung up on concerns of
futility...


On 16/6/2013 1:42 μμ, R. Michael Weylandt wrote:




## CODE SNIPPET##
a = 552315251254
b = a
c =  552315251254

a is b # True _on my machine_


 And this pattern continues for any sort of Python object.
 a is c # False _on my machine_

And in mine is also True.


 id(a)
140160465571760
 id(b)
140160465571760
 id(c)
140160465571696

Since all object result to point to actual number 6 why don't all of 
them (a,b,c) bound to the same memory address.


a and b seem both objects of the same identity, which means they are 
both bound to the same memory address(140160465571760)


how come c's memory address is different than a's and b's ?
After all, this is the 3rd object pointing to number 6.

And why not d and e and f and g are all objects of the same memory address?



In fact, b does not go through a. The memory address referenced
exists even if the a binding is removed using del a or some other
mechanism. Imagine this scenario:

[a]
 \
  6
/
[b]

Using the name a or b simply tells Python where to look for a
value, but the value itself is not associated with a or b.


If i understood you correctly, you say:

unbounded memory address = value of 6

a = pointer to memory address that holds 6
b = pointer to memory address that holds 6

So, a and b, are two objects(two variable names if you want) that are 
bounded to the same memory address. And their value is the address of 
unbounded memory address.

Correct?


what id() does, never heard of that function before.



It seems you've also never heard of Python's help function?

Try

help(id)

at your interactive prompt and see what happens.


No i had no idea thagt was a bult-in help() function.
So id() is actually the memory address of an object which uniquely 
identifies it.



--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: A few questiosn about encoding

2013-06-16 Thread Chris “Kwpolska” Warrick
On Sat, Jun 15, 2013 at 10:35 PM, Benjamin Schollnick
benja...@schollnick.net wrote:
 Nick,

 The only thing that i didn't understood is this line.
 First please tell me what is a byte value

 \x1b is a sequence you find inside strings (and byte strings, the
 b'...' format).


 \x1b is a character(ESC) represented in hex format

 b'\x1b' is a byte object that represents what?


 chr(27).encode('utf-8')
 b'\x1b'

 b'\x1b'.decode('utf-8')
 '\x1b'

 After decoding it gives the char ESC in hex format
 Shouldn't it result in value 27 which is the ordinal of ESC ?


 I'm sorry are you not listening?

 1b is a HEXADECIMAL Number.  As a so-called programmer, did you seriously
 not consider that?

 Try this:

 1) Open a Web browser
 2) Go to Google.com
 3) Type in Hex 1B
 4) Click on the first link
 5) In the Hexadecimal column find 1B.

 Or open your favorite calculator, and convert Hexadecimal 1B to Decimal
 (Base 10).

 - Benjamin



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


Better: a programmer should know how to convert hexadecimal to decimal.

0x1B = (0x1 * 16^1) + (0xB * 16^0) = (1 * 16) + (11 * 1) = 16 + 11 = 27

It’s that easy, and a programmer should be able to do that in their
brain, at least with small numbers.  Or at least know that:
http://lmgtfy.com/?q=0x1B+in+decimal

Or at least `hex(27)`; or '`{:X}'.format(27)`; or `'%X' % 27`.  (I
despise hex numbers with lowercase letters, but that’s my personal
opinion.)

--
Kwpolska http://kwpolska.tk | GPG KEY: 5EAAEA16
stop html mail| always bottom-post
http://asciiribbon.org| http://caliburn.nl/topposting.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 2:13 μμ, Jussi Piitulainen wrote:

If, instead of the above, you have

a = 6
b = a
b = 5

you will find that b == 5 and a == 6. So b is not the same as a. Else
one would have changed when the other changed. I would say that a and
b are different variables. They had the same value, briefly.


If they were different variables then they would have different memory 
addresses and they would act like two different objects.


But... both a and b are for a fact mappings for the same memory address 
as seen form the following command.


 id(a) == id(b)
True

They are like the same object with 2 different names.
Like i'am a human being and me Greek friends call me Νίκος while you 
guys call me Nick.


That the way i understand it so far.


--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Roy Smith
In article mailman.3442.1371389433.3114.python-l...@python.org,
 Chris メKwpolskaモ Warrick kwpol...@gmail.com wrote:

 (I’m using wc -c to count the bytes in all files there are.  du is
 unaccurate with files smaller than 4096 bytes.)

It's not that du is not accurate, it's that it's measuring something 
different.  It's measuring how much disk space the file is using.  For 
most files, that's the number of characters in the file rounded up to a 
full block.  For large files, I believe it also includes the overhead of 
indirect blocks or extent trees.  And, finally, for sparse files, it 
takes into account that some logical blocks in the file may not be 
mapped to any physical storage.

So, whether you want to use du or wc -c depends on what you're 
trying to measure.  If you want to know how much disk space you're 
using, du is the right tool.  If you want to know how much data will be 
transmitted if the file is serialized (i.e. packed in a tarball or sent 
via a {hg,git} clone operation), then wc-c is what you want.

All that being said, for the vast majority of cases (and I would be 
astonished if this was not true for any real-life vcs repo), the 
difference between what wc and du tell you is not worth worrying about.  
And du is going to be a heck of a lot faster.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 4:07 πμ, Nick the Gr33k wrote:

On 16/6/2013 1:51 πμ, Chris Angelico wrote:

On Sun, Jun 16, 2013 at 6:29 AM, Benjamin Schollnick
benja...@schollnick.net wrote:

cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
cur.execute('''INSERT INTO counters (url) VALUES (%s)''', page )

Sure, whoever wrote that code is a fool.

http://xkcd.com/327/

They didn't sanitize your database inputs.


I assume you're talking about the above two lines of code? They're not
SQL injection targets.


Then how those page entries found in the database Chris?


The clue is that the %s isn't in quotes.


What happens if i write it like this?

cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )

How quoting of %s helps here?


This is an out-of-band argument passing method (actually, since he's
using
MySQL (IIRC), it's probably just going to escape it and pass it on
through, but it comes to the same thing), so it's safe.


Yes iam using a comma and not a substitute operator, so input is mysql
validates.

Please explain what is an out-of-band argument passing method

What your idea of those entries made it to the counters database table?




Chris? Care to explain please?

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Ferrous Cranus

On 16/6/2013 11:35 πμ, Nick the Gr33k wrote:

On 16/6/2013 10:23 πμ, Denis McMahon wrote:

On Sat, 15 Jun 2013 22:38:38 +0300, Nick the Gr33k wrote:


PLEASE take a look, its not a huge code


First, you need to start writing your code to less than 80 columns if
you're going to keep posting it to usenet. I'm sure I'm not the only
person who can't be bothered to unwrap it.


TB behaves for me the same way. Any line  80 chars gets a newline.
Why this is happening? Why not post up to 256 chars in a single line?


Secondly, the code you posted only tells part of the story - it's
obviously missing either relevant imports or defined functions or
possibly both.

Third, it would help to see examples of (a) what you expect it to
generate, and (b) what it actually generates. You obviously have a web
server available to you - you could put both code (just append .txt to
the filename) and screenshots from your browser there with no difficulty
at all and just include links.


Actually i twas a short story since i have asked this already in 2
previous threads of mine,  but here it is the whole thing pasted in
pastebin. Its not so biug and with your talent you could understand it
in aprox. 5 mins.

http://pastebin.com/XgWKuXUC


Someone saw something that will help explain why the utf-8 converted 
filenames refuse to appear?


--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


on git gc --aggressive [was Re: Version Control Software]

2013-06-16 Thread Jason Swails
On Sat, Jun 15, 2013 at 11:55 PM, rusi rustompm...@gmail.com wrote:

 On Jun 16, 4:14 am, Chris Angelico ros...@gmail.com wrote:
  On Sun, Jun 16, 2013 at 12:16 AM, Roy Smith r...@panix.com wrote:
   The advantage of DVCS is that everybody has a full copy of the repo.
   The disadvantage of the DVCS is that every MUST have a full copy of the
   repo.  When a repo gets big, you may not want to pull all of that data
   just to get the subtree you need.
 
  Yeah, and depending on size, that can be a major problem. While git
  _will_ let you make a shallow clone, it won't let you push from that,
  so it's good only for read-only repositories (we use git to manage
  software deployments at work - shallow clones are perfect) or for
  working with patch files.
 
  Hmm. ~/cpython/.hg is 200MB+, but ~/pike/.git is only 86MB. Does
  Mercurial compress its content? A tar.gz of each comes down, but only
  to ~170MB and ~75MB respectively, so I'm guessing the bulk of it is
  already compressed. But 200MB for cpython seems like a lot.

 [I am assuming that you have run  git gc --aggressive before giving
 those figures]


Off-topic, but this is a bad idea in most cases.  This is a post including
an email from Torvalds proclaiming how and why git gc --aggressive is dumb
in 99% of cases and should rarely be used:

http://metalinguist.wordpress.com/2007/12/06/the-woes-of-git-gc-aggressive-and-how-git-deltas-work/

All the best,
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Imports (in Py3), please help a novice

2013-06-16 Thread Miki Tebeka
 Is there an import / distutils tutorial out there?  I'm looking for it, but 
 perhaps one of you already knows where to find it.  Thanks!
Did you have a look at http://docs.python.org/3.3/distutils/examples.html?

Another thing to do is to look at what other packages on PyPi are doing. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: C vs Python terminology

2013-06-16 Thread Andreas Perstinger

On 16.06.2013 14:55, Dave Angel wrote:

On 06/16/2013 07:22 AM, Andreas Perstinger wrote:

On 16.06.2013 08:32, Denis McMahon wrote:

C:

^



int a, b;
b = 6;
a = b;

In C, this places the numeric value 6 into the memory location identified

^


by the variable b,


so far so good.


then copies the value from the location pointed to by b into the
location pointed to by a.


Wrong. Neither a nor b are pointers, thus they don't point to a
memory location.
This part should be written as
then copies the value at the location identified by b to the location
identified by a.


But it doesn't.  It binds b to the same object to which a is currently
bound.


Are you aware that Denis was talking about the behaviour of C in the 
above quote?



b is a pointer to a memory location containing the value 6

  a is a pointer to another memory location also containing the value 6

Again, neither a nor b are pointers.
b is the name of a memory location containing the integer value 6.
a is the name of another memory location containing the integer value 6.



Not even close.  If you don't like the terms bound or points, the
perhaps you'd be happy with b is the name that currently knows how to
find an int object containing 6.  That object has no name, and never
will.  And it can exist for a long time with no names directly bound to it.


Again, Denis was talking about C.

Bye, Andreas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Lele Gaifax
Roy Smith r...@panix.com writes:

 In article mailman.3442.1371389433.3114.python-l...@python.org,
  Chris Kwpolska Warrick kwpol...@gmail.com wrote:

 (I€™m using wc -c to count the bytes in all files there are.  du is
 unaccurate with files smaller than 4096 bytes.)

 It's not that du is not accurate, it's that it's measuring something 
 different.  It's measuring how much disk space the file is using.  For 
 most files, that's the number of characters in the file rounded up to a 
 full block.

I think “du -c” emits a number very close to “wc -c”.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Timsort in Cpython

2013-06-16 Thread alphonse23
sorry about that. I'm new to google groups. I'm trying to make sense of 
python's implementation of timsort through cpython: 
http://hg.python.org/cpython/file/default/Objects/listobject.c

I was replying to Terry Jan Reedy

 http://hg.python.org/cpython/file/default/Objects/listsort.txt
 
 is pretty clear (to me) for most of the basics.


 Though, if anyone would be interested in helping me out further -- though by 
 all means, I'm not lazy, I can figure it myself. But, I wanted to pass in 
 variables into listsort and watch timsort work line by line in gdb. 
 
 listsort(PyListObject *self, PyObject *args, PyObject *kwds) 
 
 I've never worked with Cpython source before, but it looks like PyObject is 
 just some type of general strut.. I think anyway. How does python represent a 
 list of ints in source? and what are the two second arguments for, assuming 
 the first is the list strut. 
 



On Sunday, June 16, 2013 6:08:50 AM UTC-7, mm0fmf wrote:
 Answer: The lost context.
 
 
 
 Question: What makes top-posted replies harder to read than bottom-posted?
 
 
 
 
 
 
 
 alphons...@gmail.com wrote:
 
  Yes I've read it. Very interesting read. There are other resources too 
  online that make it very clear, for instance the wikipedia articles is 
  pretty good.
 
  
 
  Though, if anyone would be interested in helping me out further -- though 
  by all means, I'm not lazy, I can figure it myself. But, I wanted to pass 
  in 
variables into listsort and watch timsort work line by line in gdb. 
 
  
 
  listsort(PyListObject *self, PyObject *args, PyObject *kwds)
 
  
 
  I've never worked with Cpython source before, but it looks like PyObject is 
  just some type of general strut.. I think anyway. How does python represent 
  a list of ints in source? and what are the two second arguments for, 
  assuming the first is the list strut.
 
  
 
  On Saturday, June 15, 2013 12:44:01 PM UTC-7, alpho...@gmail.com wrote:
 
  I'm currently trying to make sense of Python's Timsort function. From the 
  wikipedia page I was told the algorithm is located somewhere here: 
  http://hg.python.org/cpython/file/default/Objects/listobject.c
 
 
 
 
 
 
 
  So of all the functions in there, could somebody point to me which one is 
  timsort?
 
 
 
 
 
 
 
  Thanks, if anyone can help.
 
 
 
  Alphonse23
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Jason Swails
On Sun, Jun 16, 2013 at 9:30 AM, Chris “Kwpolska” Warrick 
kwpol...@gmail.com wrote:

 On Sun, Jun 16, 2013 at 1:14 AM, Chris Angelico ros...@gmail.com wrote:
  Hmm. ~/cpython/.hg is 200MB+, but ~/pike/.git is only 86MB. Does
  Mercurial compress its content? A tar.gz of each comes down, but only
  to ~170MB and ~75MB respectively, so I'm guessing the bulk of it is
  already compressed. But 200MB for cpython seems like a lot.

 Next time, do a more fair comparison.

 I created an empty git and hg repository, and created a file promptly
 named “file” with DIGIT ONE (0x31; UTF-8/ASCII–encoded) and commited
 it with “c1” as the message, then I turned it into “12” and commited
 as “c2” and did this one more time, making the file “123” at commit
 named “c3”.

 [kwpolska@kwpolska-lin .hg@default]% cat * */* */*/* 2/dev/null | wc -c
 1481
 [kwpolska@kwpolska-lin .git@master]% cat * */* */*/* */*/*/* 2/dev/null
 | wc -c
 16860 ← WRONG!

 There is just one problem with this: an empty git repository starts at
 15216 bytes, due to some sample hooks.  Let’s remove them and try
 again:

 [kwpolska@kwpolska-lin .git@master]% rm hooks/*
 [kwpolska@kwpolska-lin .git@master]% cat * */* */*/* */*/*/* */*/*/*
 2/dev/null | wc -c
 2499

 which is a much more sane number.  This includes a config file (in the
 ini/configparser format) and such.  According to my maths skils (or
 rather zsh’s skills), new commits are responsible for 1644 bytes in
 the git repo and 1391 bytes in the hg repo.


This is not a fair comparison, either.  If we want to do a fair comparison
pertinent to this discussion, let's convert the cpython mercurial
repository into a git repository and allow the git repo to repack the diffs
the way it deems fit.

I'm using the git-remote-hg.py script [
https://github.com/felipec/git/blob/fc/master/contrib/remote-helpers/git-remote-hg.py]
to clone a mercurial repo into a native git repo.  Then, in one of the rare
cases, using git gc --aggressive. [1]

The result:

Git:
cpython_git/.git $ du -h --max-depth=1
40K ./hooks
145M ./objects
20K ./logs
24K ./refs
24K ./info
146M .

Mercurial:
cpython/.hg $ du -h --max-depth=1
209M ./store
20K ./cache
209M .


And to help illustrate the equivalence of the two repositories:

Git:

cpython_git $ git log | head; git log | tail

commit 78f82bde04f8b3832f3cb6725c4bd9c8d705d13b
Author: Brett Cannon br...@python.org
Date:   Sat Jun 15 23:24:11 2013 -0400

Make test_builtin work when executed directly

commit a7b16f8188a16905bbc1d49fe6fd940078dd1f3d
Merge: 346494a af14b7c
Author: Gregory P. Smith g...@krypto.org
Date:   Sat Jun 15 18:14:56 2013 -0700
Author: Guido van Rossum gu...@python.org
Date:   Mon Sep 10 11:15:23 1990 +

Warning about incompleteness.

commit b5e5004ae8f54d7d5ddfa0688fc8385cafde0e63
Author: Guido van Rossum gu...@python.org
Date:   Thu Aug 9 14:25:15 1990 +

Initial revision

Mercurial:

cpython $ hg log | head; hg log | tail

changeset:   84163:5b90da280515
bookmark:master
tag: tip
user:Brett Cannon br...@python.org
date:Sat Jun 15 23:24:11 2013 -0400
summary: Make test_builtin work when executed directly

changeset:   84162:7dee56b6ff34
parent:  84159:5e8b377942f7
parent:  84161:7e06a99bb821
user:Guido van Rossum gu...@python.org
date:Mon Sep 10 11:15:23 1990 +
summary: Warning about incompleteness.

changeset:   0:3cd033e6b530
branch:  legacy-trunk
user:Guido van Rossum gu...@python.org
date:Thu Aug 09 14:25:15 1990 +
summary: Initial revision

They both appear to have the same history.  In this particular case, it
seems that git does a better job in terms of space management, probably due
to the fact that it doesn't store duplicate copies of identical source code
that appears in different files (it tracks content, not files).

That being said, from what I've read both git and mercurial have their
advantages, both in the performance arena and the features/usability arena
(I only know how to really use git).  I'd certainly take a DVCS over a
centralized model any day.

All the best,
Jason

[1] I know I just posted in this thread about --aggressive being bad, but
the packing from the translation was horrible -- the translated git repo
was ~2 GB in size.  An `aggressive' repacking was necessary to allow git to
decide how to pack the diffs.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: on git gc --aggressive [was Re: Version Control Software]

2013-06-16 Thread rusi
On Jun 16, 7:09 pm, Jason Swails jason.swa...@gmail.com wrote:
 On Sat, Jun 15, 2013 at 11:55 PM, rusi rustompm...@gmail.com wrote:
  On Jun 16, 4:14 am, Chris Angelico ros...@gmail.com wrote:
   On Sun, Jun 16, 2013 at 12:16 AM, Roy Smith r...@panix.com wrote:
The advantage of DVCS is that everybody has a full copy of the repo.
The disadvantage of the DVCS is that every MUST have a full copy of the
repo.  When a repo gets big, you may not want to pull all of that data
just to get the subtree you need.

   Yeah, and depending on size, that can be a major problem. While git
   _will_ let you make a shallow clone, it won't let you push from that,
   so it's good only for read-only repositories (we use git to manage
   software deployments at work - shallow clones are perfect) or for
   working with patch files.

   Hmm. ~/cpython/.hg is 200MB+, but ~/pike/.git is only 86MB. Does
   Mercurial compress its content? A tar.gz of each comes down, but only
   to ~170MB and ~75MB respectively, so I'm guessing the bulk of it is
   already compressed. But 200MB for cpython seems like a lot.

  [I am assuming that you have run  git gc --aggressive before giving
  those figures]

 Off-topic, but this is a bad idea in most cases.  This is a post including
 an email from Torvalds proclaiming how and why git gc --aggressive is dumb
 in 99% of cases and should rarely be used:

 http://metalinguist.wordpress.com/2007/12/06/the-woes-of-git-gc-aggre...

Yeah... Thanks for that link.
I knew there's something about gc and something about pack. Too much
of a git noob to know which is which!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Version Control Software

2013-06-16 Thread Terry Reedy

On 6/16/2013 11:48 AM, Lele Gaifax wrote:

Roy Smith r...@panix.com writes:


In article mailman.3442.1371389433.3114.python-l...@python.org,
  Chris Kwpolska Warrick kwpol...@gmail.com wrote:


(I��m using wc -c to count the bytes in all files there are.  du is
unaccurate with files smaller than 4096 bytes.)


It's not that du is not accurate, it's that it's measuring something
different.  It's measuring how much disk space the file is using.  For
most files, that's the number of characters in the file rounded up to a
full block.


I think “du -c” emits a number very close to “wc -c”.


In Windows Explorer, the Properties box displays both the Size and 'Size 
on disk', in both (KB or MB) and bytes. The block size for the disk I am 
looking at is 4KB, so the Size on disk in KB is a multiple of that.


--
Terry Jan Reedy


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


Re: Don't feed the troll...

2013-06-16 Thread Antoon Pardon

Op 15-06-13 21:29, Steven D'Aprano schreef:

On Sat, 15 Jun 2013 11:18:03 -0700, rusi wrote:


At least two people -- Alex and Antoon -- have told you that by
supporting Nikos, when everyone else wants him off list, you are part of
the problem.


And others have publicly thanked me for giving useful answers to Nikos,
because they have learned from them.


That doesn't contradict that you may be part of the problem. There is
something like the law of diminishing returns. So the kind of respons
that is helpful at the beginnig can become part of the problem when it
becomes part of a seemingly endless cycle.


You replied to Antoon, and agreed with his position that we should shun
Nikos, then *immediately* contradicted yourself by stating that Robert
Kern's helpful answers were the ideal. And then, just to further
demonstrate that your actions are at best inconsistent and at worst
hypocritical, you have since gone on to fire barbs at Nikos instead of
ignoring him. So please tend to the beam in your own eye before pointing
at the mote in mine.


So what. We all are somewhat inconsistent and hypocritical. That doesn't
make your responses unproblematic. If in the future you want to respond
like Robert Kern that seems fine enough. But if you continue like you
are now, I'll consider you an enabler.


Others -- Fabio -- have indicated their wish to leave the list due to
everything becoming Nikos-tainted.


That would be disappointing, but there's nothing I can do about it.


Yes you can. You can stop enabling his behaviour. Now you may think
this is an unacceptable option for and that is something you will
have to decide for yourself but you do have a choice.


Everyone is exasperated and talking of kill-filing him.


Then why don't they? Don't feed the troll includes trying to beat him
into submission with insults and half-witty remarks.


Not feeding the troll doesn't help. If people are transgressing the
social norms in a community, they need to get a response that makes
it clear they crossed the line. If they don't you are implicetly
broadcasting the message there is no out of bound behaviour.


This is not about Nikos. It's about those who are also doing their bit to
make this community an ugly, hostile place. I won't mention names -- you
know who you are. Those who take it upon themselves to bait and prod and
poke Nikos with insults and inflammatory replies.  Appointing themselves
Internet Police and making ridiculous claims that Nikos ought to be
reported to the police. Sending bogus complaints to the domain registrar.
There is a word for this sort of behaviour: bullying. I don't care how
morally justified you think you are, you are now just as big a part of
the problem as Nikos.


You are trying to get it both ways. On the one hand you try to argue
that there are no boundaries to what is acceptable by calling people
who do try to enforce such boundaries the Internet Police. On the
other hand you do suggest that playing Internet Police is out of
bound behaviour.

You have to make a choice. Either you don't want to recognize there
can be something like out of bound behaviour and then people making
this community an ugly hostile place is acceptable. Or you think
there is behaviour that is out of bounds and then you must consider
the possiblity that Nikos behaviour is an example of that and that
what you consider ugly responses are people trying to address that
out of bound behaviour and that you responding to Nikos as you do
for the moment is perpetuating Nokos's unacceptable behaviour.

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


Re: Imports (in Py3), please help a novice

2013-06-16 Thread John Ladasky
Thanks for your reply, Miki.

On Sunday, June 16, 2013 7:50:53 AM UTC-7, Miki Tebeka wrote:
  Is there an import / distutils tutorial out there?  I'm looking for it, but 
  perhaps one of you already knows where to find it.  Thanks!
 
 Did you have a look at http://docs.python.org/3.3/distutils/examples.html?

I wrote: I've just spent the past few hours trying to read the distutils 
documentation... but I didn't quite get as far as Section 7, the Examples.  I 
was trying to RTFM linearly, beginning (naturally) at the beginning:

http://docs.python.org/3.3/distutils/introduction.html

I see some new things in the Examples section that I might try.

 Another thing to do is to look at what other packages on PyPi are doing.

That's what I was trying to do by looking at numpy, matplotlib, and wx on my 
own system -- but they are all too complex.  I'll have a look at PyPI, and with 
luck I will find some simpler examples.  Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread R. Michael Weylandt
On Sun, Jun 16, 2013 at 2:38 PM, Ferrous Cranus supp...@superhost.gr wrote:
 On 16/6/2013 3:04 μμ, R. Michael Weylandt wrote:
 ## CODE SNIPPET##
 a = 552315251254
 b = a
 c =  552315251254

 a is b # True _on my machine_


 And this pattern continues for any sort of Python object.
 a is c # False _on my machine_

 And in mine is also True.


What do you mean also true here? You can't be also true in the
presence of a false. This makes little sense to me...


 id(a)
 140160465571760
 id(b)
 140160465571760
 id(c)
 140160465571696

 Since all object result to point to actual number 6 why don't all of them
 (a,b,c) bound to the same memory address.

Look at the code they follow. (At least in this email) -- none of them
point to an object with value 6. They all point to a much larger
value.


 a and b seem both objects of the same identity, which means they are both
 bound to the same memory address(140160465571760)

Yes


 how come c's memory address is different than a's and b's ?
 After all, this is the 3rd object pointing to number 6.

Again, no it's not.


 And why not d and e and f and g are all objects of the same memory address?

What are these variables? They are referenced nowhere in any mail
between you and me.



a and b are the same object, with two different names. (No if I want
about it -- the distinction is important)

No idea what you mean by unbounded memory address here. (Yes I'm
aware I deleted a fairly meaningless line about it from the context)


 No i had no idea thagt was a bult-in help() function.
 So id() is actually the memory address of an object which uniquely
 identifies it.

Yes.


I think part of your confusion is coming from the dual interpretation
of the = operator in an expression like:

LHS = RHS

If RHS is some sort of literal, a conforming Python behaves as if
(modulo optimizations described below) a new object is created
according to that literal, put in memory and the name LHS is used to
point to it.

If RHS is a name (as in code such as a = b), the Python will find
the object to which b refers and add a new reference (a) to it.

Some information on the CPython specific implementation details:

As part of the startup process, CPython creates some number of small
integers and adds them to the object cache.

Why? Because creating an object (even as simple as an int) is
relatively expensive and small integers are ubiquitous in programming.
This sacrifices some memory for a good deal of speed. But the payoff
becomes less as you go higher: almost all programs will use a 0 or a
2, fewer will use 247. At some point, the pre-creation stops. I
believe this is a compile time option.

Now, to make effective use of this caching, CPython will use a few
tricks to try to identify when one of the small ints appears in the
code. If it can identify it, I will replace the object creation with a
reference to the in-cache object. The exact times when this can happen
are not -- to my knowledge -- documented anywhere.

Now you might ask why Python doesn't realize that, in code like my
code snippet above, it could simply reuse the same int object for a,
b, and c. Conceivably it could, but it would require enormous energies
to check all currently existing objects for one that happens to be
equal to what you need (and is not mutable if that's relevant) and
it's simply faster to create the new int.

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


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread R. Michael Weylandt
On Sun, Jun 16, 2013 at 2:47 PM, Ferrous Cranus supp...@superhost.gr wrote:
 On 16/6/2013 2:13 μμ, Jussi Piitulainen wrote:

 If, instead of the above, you have

 a = 6
 b = a
 b = 5

 you will find that b == 5 and a == 6. So b is not the same as a. Else
 one would have changed when the other changed. I would say that a and
 b are different variables. They had the same value, briefly.


 If they were different variables then they would have different memory
 addresses and they would act like two different objects.

 But... both a and b are for a fact mappings for the same memory address as
 seen form the following command.

 id(a) == id(b)
 True

 They are like the same object with 2 different names.

This will depend on when the test is run:

a = 6
b = a
a is b # True

b = 5
a is b # False

The latter is false because the binding of b to the int 6 was broken
in order to bind b to the int 5.

I might also suggest you restrain from trying to correct respondents
on these matters until you yourself understand them. It's only polite.

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


Re: My son wants me to teach him Python

2013-06-16 Thread Rick Johnson
On Thursday, June 13, 2013 11:05:00 PM UTC-5, Chris Angelico wrote:

Chris, a GUI interface can be created for *ANY* command line
functionality. By utilizing the GUI you can be more
productive because a point and a click are always faster
than peck-peck-peck * INFINITY. 

For instance, if i want to start a certain program (or func)
on the commandline, first i will need to know what commands
are available. To see these commands i must *FIRST* type a
command. On the windows box that command would be help.
Now hopefully the command list will fit within the console's
buffer capacity, or else i need to enter a page buffer mode
(SOMEBODY KILL ME NOW!!!).

This is where the GUI shines!

When i choose to open my system tools gui (instead of the
antiquated text only console), a list of commands will be
displayed in a nice list box with scroll-bars that have near
unlimited capacity to scroll. All i need to do is point
and click and this magical piece of software runs
another GUI program for that specific task or tool.

 Also - Show me an efficient way, with a GUI, to invoke any
 file with any program with any parameters, without
 cheating and using something like Alt-F2 to enter a
 command line. Your solution must be utterly generic. I
 need to be able to tail -F and tail -f a file.

Just because you lack the graphical tools on your machine,
or the skill to create those graphical tools on your
machine, does not mean the rest of us are as incapable. 

Note: The following solution requires you to have a windows
OS, if you are using anything else, then you should be geeky
enough to roll your own solution!

## BEGIN SCRIPT ##
# Python Version  3.0 only!
import sys, os
import Tkinter as tk
import tkSimpleDialog, tkMessageBox

msg1 = 'Greetings master, by what method shall i execute {0}?'
msg2 = \
And the master sayeth:

{0}

So it is written, so shall it be done
ivalue = some/path/to/nowhere.txt -opt1=foo -opt2=bar

def prompt_master():
argv = sys.argv
path = argv[1]
fname = os.path.basename(path)
msg = msg1.format(fname)
argstr = tkSimpleDialog.askstring('',
  msg,
  initialvalue=ivalue,
  parent=root
  )
if argstr:
tkMessageBox.showinfo('', msg2.format(argstr),parent=root)
os.system('{0} {1}'.format(path, argstr))
root.destroy()

if __name__ == '__main__':
root = tk.Tk()
root.withdraw()
prompt_master()
root.mainloop()
## END SCRIPT ##

Save that code in a file named PepsiChallenge.py, then
throw that script in your Send To folder and it
magically becomes accessible from the SendTo command of
the windows context menu. If you don't know where to find
your windows send to folder then ask my good friend
Google.

To use, simply open your windows file browser, navigate to a
file icon, right click the file, and send it to the
PepsiChallenge script. 

By doing this we've harnessed the power of an existing GUI
without actually writing all the GUI code. But more
importantly we've won the challenge :-P

*school-bell*
-- 
http://mail.python.org/mailman/listinfo/python-list


Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread C. N. Desrosiers
Hi,

I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.  I'd 
like to write a program that boots my computer at a specific time, loads 
iTunes, and starts playing a podcast.  Is this sort of thing possible in Python?

Thanks in advance.

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


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 12:06:08 -0700, C. N. Desrosiers wrote:

 Hi,
 
 I'm planning to buy a Macbook Air and I want to use it as a sort of
 alarm.  I'd like to write a program that boots my computer at a specific
 time,

If your computer is turned off, how is the program supposed to run?



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


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Joel Goldstick
On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers cndesrosi...@gmail.comwrote:

 Hi,

 I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.
  I'd like to write a program that boots my computer at a specific time,
 loads iTunes, and starts playing a podcast.  Is this sort of thing possible
 in Python?

 Thanks in advance.


Since Macs run a version of Unix underneath you can write a cron job to get
things started at a specific time.  I'm not sure about the iTunes
interface.  Have you researched to see if it has and API?  If it does,
likely python could handle that.


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




-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.]

2013-06-16 Thread Mark Janssen
 Whats the difference of interpreting  to compiling ?

 OK, I give up!

 Actually, that's a more subtle question than most people think. Python,
 for example, is a compiled language. (What did you think the c in
 .pyc files stood for? and the compile() function?)

Careful there.  This terminology is not agreed upon universally (that
is, within the realm of academia where the notion of mastery exists),
and unless you are citing an actual reference or publishing one
yourself, then you may be adding more confusion than illumination.
For example, I would say that it is an *interpreted language* that
gets compiled at run-time.  Some (*valid*) definitions of compiler
mean a strict mapping from the language syntax and lexical definition
to a sequence of bytes that can be fed to a (hardware not virtual)
machine architecture to do perform what is requested.  The face that
an extension ends in the letter c is not sufficient evidence, since
file extensions have no strict standard.

 And these days, for many types of hardware, even machine-code is often
 interpreted by a virtual machine on a chip. And even languages which
 compile to machine-code often use an intermediate platform-independent
 form rather than targeting pure machine-code.

Do you have a reference for this?  What language?

 The line between compilers
 and interpreters is quite fuzzy.

It shouldn't be.  What is fuzzy is the definition of interpreter,
however.  The definition of compiler has only become fuzzy with the
advent of the personal computer.

 Probably the best definition I've seen for the difference between a
 modern compiler and interpreter is this one:

 ...the distinguishing feature of interpreted languages is not that they
 are not compiled, but that the compiler is part of the language runtime
 and that, therefore, it is possible (and easy) to execute code generated
 on the fly.

That's reasonable.
-- 
MarkJ
Tacoma, Washington
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Joel Goldstick
On Sun, Jun 16, 2013 at 3:22 PM, Steven D'Aprano 
steve+comp.lang.pyt...@pearwood.info wrote:

 On Sun, 16 Jun 2013 12:06:08 -0700, C. N. Desrosiers wrote:

  Hi,
 
  I'm planning to buy a Macbook Air and I want to use it as a sort of
  alarm.  I'd like to write a program that boots my computer at a specific
  time,

 If your computer is turned off, how is the program supposed to run?


I was thinking maybe it could in some sleep mode that still ran cron jobs.
but I am totally guessing that.  If its OFF off then you might need another
computer attached to a robot arm that could push the on button first!




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




-- 
Joel Goldstick
http://joelgoldstick.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Petite Abeille

On Jun 16, 2013, at 9:06 PM, C. N. Desrosiers cndesrosi...@gmail.com wrote:

 I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.  
 I'd like to write a program that boots my computer at a specific time, loads 
 iTunes, and starts playing a podcast.

Under preferences, take a look at Energy Saver - Power Adapter - Schedule - 
Start up or wake.

Alternatively, the command line utility pmset allows one to access the same 
functionalities.

  Is this sort of thing possible in Python?

Sure. But why bother? All at one's finger tip already...



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


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Jason Swails
On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers cndesrosi...@gmail.comwrote:

 Hi,

 I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.
  I'd like to write a program that boots my computer at a specific time,
 loads iTunes, and starts playing a podcast.  Is this sort of thing possible
 in Python?


Python cannot do this by itself, as has already been mentioned.

If you're using a Mac, you can schedule your computer to turn on (and/or
off) using System Preferences-Energy Saver-Schedule...

Then run a Python script in a cron job.

In fact, you could do this in bash ;)

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


Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.]

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 12:31:59 -0700, Mark Janssen wrote:

 Whats the difference of interpreting  to compiling ?

 OK, I give up!

 Actually, that's a more subtle question than most people think. Python,
 for example, is a compiled language. (What did you think the c in
 .pyc files stood for? and the compile() function?)
 
 Careful there.  This terminology is not agreed upon universally

Which is why I said it was a more subtle question than most people think. 
Most people think that there is One True Definition of compiling/
interpreting, usually based on an over-simplified model of program 
execution that was obsolete in the 1970s.

 (that
 is, within the realm of academia where the notion of mastery exists),

The notion of mastery exists in many places, not just academia.


 and unless you are citing an actual reference or publishing one
 yourself, then you may be adding more confusion than illumination. For
 example, I would say that it is an *interpreted language* that gets
 compiled at run-time.

Apart from the contradiction there -- if it is compiled, why do you 
insist on calling it interpreted? -- you would be wrong. Languages are 
neither interpreted nor compiled. Languages are abstract entities that 
describe what syntax is permitted, and what functionality is provided. It 
is only concrete implementations which are interpreted or compiled.

In the case of Python, we have:

CPython: compiled to byte-code for it's own virtual machine;

Jython: compiled to byte-code for the JRE;

IronPython: compiled to byte-code for the .Net runtime;

PyPy: JIT compiler that generates machine code;

Nuitka: static compiler that generates machine code;

etc. So, the answer to the question Is Python compiled or interpreted? 
is, Yes.



[...]
 And these days, for many types of hardware, even machine-code is often
 interpreted by a virtual machine on a chip. And even languages which
 compile to machine-code often use an intermediate platform-independent
 form rather than targeting pure machine-code.
 
 Do you have a reference for this?  What language?

https://en.wikipedia.org/wiki/Microcode



 The line between compilers
 and interpreters is quite fuzzy.
 
 It shouldn't be.

Of course it should be, because that reflects reality.


 What is fuzzy is the definition of interpreter,
 however.  The definition of compiler has only become fuzzy with the
 advent of the personal computer.

Incorrect. Lisp predates the PC, and it is a good example of a language 
with implementations which combine features of compile-to-machine-code 
and execute-high-level-code-at-run-time (i.e. both compiler and 
interpreter behaviour, at the same time). Lisp is nearly as old as 
Fortran.

Forth is another such language. It's not quite so old as Lisp, but it is 
especially interesting because Forth includes commands to switch from 
compile mode to interpret mode on the fly. So is it a compiler or an 
interpreter? Yes.


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


Re: Don't feed the troll...

2013-06-16 Thread Steven D'Aprano
On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote:

 You are trying to get it both ways. On the one hand you try to argue
 that there are no boundaries 

I have never, ever argued that there are no boundaries. I have repeatedly 
made it clear to Nikos when I thought he was behaving improperly. And 
I've done the same to others when they've acted improperly.


 to what is acceptable by calling people who
 do try to enforce such boundaries the Internet Police. On the other hand
 you do suggest that playing Internet Police is out of bound behaviour.

Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It 
is unproductive, it makes this a hostile, unpleasant place to be, it 
ruins the environment for the rest of the community, it's off topic, and 
it simply doesn't work to discourage trolls.


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


Re: Timsort in Cpython

2013-06-16 Thread Ian Kelly
On Sat, Jun 15, 2013 at 10:05 PM,  alphons...@gmail.com wrote:
 Yes I've read it. Very interesting read. There are other resources too online 
 that make it very clear, for instance the wikipedia articles is pretty good.

 Though, if anyone would be interested in helping me out further -- though by 
 all means, I'm not lazy, I can figure it myself. But, I wanted to pass in 
 variables into listsort and watch timsort work line by line in gdb.

 listsort(PyListObject *self, PyObject *args, PyObject *kwds)

 I've never worked with Cpython source before, but it looks like PyObject is 
 just some type of general strut.. I think anyway. How does python represent a 
 list of ints in source? and what are the two second arguments for, assuming 
 the first is the list strut.

A PyObject* generally references any Python object.  The subtype
PyListObject* more specifically references a Python list.  The above
signature corresponds to this Python function signature:

def listsort(self, *args, **kwds):

The first argument self is the list object to be operated on.  The
second argument args is a Python tuple containing any other positional
arguments that were passed into the method.  The third argument kwds
is a Python dict containing any keyword arguments that were passed
into the method.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread C. N. Desrosiers
Thank you!


On Sun, Jun 16, 2013 at 3:49 PM, Jason Swails jason.swa...@gmail.comwrote:




 On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers 
 cndesrosi...@gmail.comwrote:

 Hi,

 I'm planning to buy a Macbook Air and I want to use it as a sort of
 alarm.  I'd like to write a program that boots my computer at a specific
 time, loads iTunes, and starts playing a podcast.  Is this sort of thing
 possible in Python?


 Python cannot do this by itself, as has already been mentioned.

 If you're using a Mac, you can schedule your computer to turn on (and/or
 off) using System Preferences-Energy Saver-Schedule...

 Then run a Python script in a cron job.

 In fact, you could do this in bash ;)

 HTH,
 Jason




-- 
Christian Nicolás Desrosiers
Master of City Planning candidate
School of Architecture + Planning
Massachusetts Institute of Technology

t. 717 860 6252
e. c...@mit.edu

www.twitter.com/cndesrosiers
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My son wants me to teach him Python

2013-06-16 Thread Chris Angelico
On Mon, Jun 17, 2013 at 5:04 AM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
 Chris, a GUI interface can be created for *ANY* command line
 functionality. By utilizing the GUI you can be more
 productive because a point and a click are always faster
 than peck-peck-peck * INFINITY.


Okay... I'm trying to get my head around what you've done here. Isn't
it simply that you've made a way to, with what looks like a
point-and-click interface, let the user type in a command line? Or
even worse, force them to edit a file to change the command used? That
already exists - as I mentioned, several desktop environments have
Alt-F2 to let you type in any program and run it. That's no more using
a GUI than bringing up a terminal is.

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


Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Chris Angelico
On Mon, Jun 17, 2013 at 5:06 AM, C. N. Desrosiers
cndesrosi...@gmail.com wrote:
 Hi,

 I'm planning to buy a Macbook Air and I want to use it as a sort of alarm.  
 I'd like to write a program that boots my computer at a specific time, loads 
 iTunes, and starts playing a podcast.  Is this sort of thing possible in 
 Python?


Python *on the system itself* cannot do this. However, if the BIOS
features aren't enough (eg if you want more flexibility), there's one
option to explore. See if your Macbook has Wake-On-LAN support; with
that, you could have a Python script *on a different machine* send a
magic packet that wakes your target. However, this isn't a Python
question, it's a systems administration one. (The very specific
question How can I trigger wake-on-LAN from a Python program would
be a Python question (obviously!), but that's only a tiny part of your
problem.)

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


Re: Compiling vs interpreting [was Re: A certainl part of an if() structure never gets executed.]

2013-06-16 Thread Chris Angelico
On Mon, Jun 17, 2013 at 6:02 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, 16 Jun 2013 12:31:59 -0700, Mark Janssen wrote:
 The line between compilers
 and interpreters is quite fuzzy.

 It shouldn't be.

 Of course it should be, because that reflects reality.

It's fuzzy AND it seldom even matters. Compare these three text strings:

''

'a'*64

\37\213\b\b*8\276Q\0\3test\0KL\244\f\0\0Ue\264\211@\0\0\0

\x78\xda\x4b\x4c\xa4\x0c\0\0\x14\x8d\x18\x41

Which of these is an interpreted program? I would say: All of them.
And they all produce the same output, a series of 64 copies of the
letter a. The third one is interpreted by gzip(1) and will create a
file called 'test', the fourth is a raw gzip/zlib stream and so is
interpreted by (eg) the Python zlib.decompress() function. They're all
languages, of a sort. Are they interpreted/compiled versions of that
message? Kinda. If you prepend a sfx header to them, do they become
compiled and not interpreted? Doubtful. I don't think you could say
that this ceases to be interpreted:

import zlib
print(zlib.decompress(
\x78\xda\x4b\x4c\xa4\x0c\0\0\x14\x8d\x18\x41
))

Even if you manually imported the code for zlib.decompress, in a way
that makes it impossible for your cut-down program to actually
compress data (which then breaks the principle quoted from
Programming in Lua), it's still fairly clearly being
interpreted/parsed the exact same way.

So it really doesn't matter (so it really doesn't matter (so it really
doesn't matter)). [1]

ChrisA

[1] http://math.boisestate.edu/gas/ruddigore/web_opera/rudd24.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My son wants me to teach him Python

2013-06-16 Thread Rick Johnson
On Sunday, June 16, 2013 4:52:16 PM UTC-5, Chris Angelico wrote:

 Okay... I'm trying to get my head around what you've done
 here. Isn't it simply that you've made a way to, with what
 looks like a point-and-click interface, let the user type
 in a command line? 
 [...] 
 That's no more using a GUI than bringing up a terminal is.

Yes, a Graphical Interface will need the occasional peck-peck input from the 
user, the only difference from a text based interface is the INFINITY 
multiplier. The Graphical Interface prefers the point and click, but NOT 
exclusively! The Graphical Interface allows you apply the most efficient method 
by which to solve a problem -- again, that might be peck-peck or 
point-click, OR, a combination of both. Depends on the situation really. 

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


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread alex23
On Jun 16, 10:10 am, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
 Congratulation. You have just entered an extremely exclusive club. See
 you in a month.

 *plonk*

So yours are the only pissy one-liner responses that shouldn't be
taken off-list?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why 'files.py' does not print the filenames into a table format?

2013-06-16 Thread Mark Lawrence

On 17/06/2013 01:04, alex23 wrote:

On Jun 16, 10:10 am, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:

Congratulation. You have just entered an extremely exclusive club. See
you in a month.

*plonk*


So yours are the only pissy one-liner responses that shouldn't be
taken off-list?



I suggest caution, Big Brother is watching *YOU* :)

--
Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green. Snooker 
commentator 'Whispering' Ted Lowe.


Mark Lawrence

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


Re: Imports (in Py3), please help a novice

2013-06-16 Thread Chris Angelico
On Mon, Jun 17, 2013 at 4:46 AM, John Ladasky
john_lada...@sbcglobal.net wrote:
 I was trying to RTFM linearly, beginning (naturally) at the beginning

Alas, the King of Hearts's good advice [1] doesn't work so well with
large documentation. :) It seems distutils is rather more complicated
than could be desired; but wasn't there a project a while ago to
simplify all that mess? Or was distutils the result of that, and it
used to be worse?

ChrisA

[1] To the White Rabbit -
http://en.wikisource.org/wiki/Alice%27s_Adventures_in_Wonderland/Chapter_12#182
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: C vs Python terminology

2013-06-16 Thread Dave Angel

On 06/16/2013 11:02 AM, Andreas Perstinger wrote:

On 16.06.2013 14:55, Dave Angel wrote:

On 06/16/2013 07:22 AM, Andreas Perstinger wrote:
   SNIP
But it doesn't.  It binds b to the same object to which a is currently
bound.


Are you aware that Denis was talking about the behaviour of C in the
above quote?



Nope, missed that.  Sorry for the noise.


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


Re: Don't feed the troll...

2013-06-16 Thread rurpy
On 06/16/2013 02:04 PM, Steven D'Aprano wrote:
 On Sun, 16 Jun 2013 20:16:34 +0200, Antoon Pardon wrote:
 
 You are trying to get it both ways. On the one hand you try to argue
 that there are no boundaries 
 
 I have never, ever argued that there are no boundaries. I have repeatedly 
 made it clear to Nikos when I thought he was behaving improperly. And 
 I've done the same to others when they've acted improperly.

 to what is acceptable by calling people who
 do try to enforce such boundaries the Internet Police. On the other hand
 you do suggest that playing Internet Police is out of bound behaviour.
 
 Yes. Trying to start flame wars with Nikos is unacceptable behaviour. It 
 is unproductive, it makes this a hostile, unpleasant place to be, it 
 ruins the environment for the rest of the community, it's off topic, and 
 it simply doesn't work to discourage trolls.

The difficulty with trying to suppress such responses is that 
the flamers get just as much pleasure from having a target
to unrestrainedly spew their pent up anger and vile at, as 
the troll gets from simulating that reaction.  The result is 
a positive feedback loop.  

I could be wrong but I don't think Nikos is a pure troll -- 
someone motivated purely by provoking reaction and discord.
He has a real website and his problems with Python seem like 
genuine problems many beginners have.  He seems to have little 
knowledge, not much concern for anyone else but a lot of
determination to get things working.  I have certainly known
people like that in the real world.

I speculate that half of his bad behavior is simple I want 
now and don't care about your conventions.  The rest is a
reaction to we're the alphas, your a beta attitude expressed
by many here and later, overt hostility directed at him.  He 
has changed some things -- his posting method, he's made an 
effort to understand his encoding issues, etc.

So I think Steven's approach of responding to his questions, 
at least those that are coherent and don't require reading a 
dozen posts over several threads to piece together, with an 
actual attempt to help (not a bunch of obscure hints, links 
to wikipedia, and you're an idiot replies) is right.
If Nikos fails to respond with better questions, then those 
that do answer will get tired of trying to help and stop 
answering.  In the meantime everyone else can just killfile
or otherwise ignore him rather than egging him on by 
intentionally provoking him (unless of course you enjoy
the results.)

So positive reinforcement for less bad behavior, negative 
reinforcement (which for trolling is NO response, not negative 
responses) for more bad.  Standard behavioral conditioning.

And if it doesn't work it will still be a much nicer and 
quieter here with only Nikos' trolling than with 10x as much 
garbage from the local vigilantes who are more obnoxious
than he.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Don't feed the troll...

2013-06-16 Thread Ferrous Cranus

On 17/6/2013 6:46 πμ, ru...@yahoo.com wrote:

I could be wrong but I don't think Nikos is a pure troll --
someone motivated purely by provoking reaction and discord.
He has a real website and his problems with Python seem like
genuine problems many beginners have.  He seems to have little
knowledge, not much concern for anyone else but a lot of
determination to get things working.  I have certainly known
people like that in the real world.


This is the best definition of me.
It is very nice to see that someone has understood my character and 
intentions.


The only thing i'm feeling guilty is that instead of reading help files 
and PEP's which seem too technical for me, i prefer the live help of an 
actual expert human being.


An yes, i'm not trolling this fine newsgroup.
If it wasn't for the help of some of the nicest fellows here my site 
would be up and working neither with Python 3.3.2 nor with 2.6.


Many difficulties that occurred to me when trying to write some code 
were addresses here making my website actually happen.


I could have made it to Joomla(that's web design) instead of Python(web 
development_ but i really like Python and the reason i ask in detail is 
because i don't want only provided code that will help address an issue 
i have, but i want to know how things work.


Thanks for understanding me ruspy.

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: A certainl part of an if() structure never gets executed.

2013-06-16 Thread Νίκος

On 16/6/2013 9:53 μμ, R. Michael Weylandt wrote:

On Sun, Jun 16, 2013 at 2:47 PM, Ferrous Cranus supp...@superhost.gr wrote:

On 16/6/2013 2:13 μμ, Jussi Piitulainen wrote:


If, instead of the above, you have

a = 6
b = a
b = 5

you will find that b == 5 and a == 6. So b is not the same as a. Else
one would have changed when the other changed. I would say that a and
b are different variables. They had the same value, briefly.



If they were different variables then they would have different memory
addresses and they would act like two different objects.

But... both a and b are for a fact mappings for the same memory address as
seen form the following command.


id(a) == id(b)

True

They are like the same object with 2 different names.


This will depend on when the test is run:

a = 6
b = a
a is b # True

b = 5
a is b # False

The latter is false because the binding of b to the int 6 was broken
in order to bind b to the int 5.


Very surprising.
a and b was *references* to the same memory address, it was like a 
memory address having 2 names to be addresses as.


b = a name we use to address some memory location, do we agree on that?

So, b = 6, must have changed the stored value of its mapped memory 
location, but given you example it seems its changing the mapping of b 
to some other memory address.


I don't follow its act of course.

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Don't feed the troll...

2013-06-16 Thread rusi
On Jun 16, 12:54 am, ru...@yahoo.com wrote:

 ... killfile him and shut the fuck up.

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


[issue18219] csv.DictWriter is slow when writing files with large number of columns

2013-06-16 Thread Mikhail Traskin

Mikhail Traskin added the comment:

Any way is fine with me. If you prefer to avoid having public filedset 
property, please use the attached patch.

--
Added file: http://bugs.python.org/file30605/csvdictwriter.v2.patch

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



[issue18227] Use Python memory allocators in external libraries like zlib or OpenSSL

2013-06-16 Thread Aaron Iles

Changes by Aaron Iles aaron.i...@gmail.com:


--
nosy: +aliles

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



[issue18203] Replace direct calls to malloc() with PyMem_Malloc() or PyMem_RawMalloc()

2013-06-16 Thread Aaron Iles

Changes by Aaron Iles aaron.i...@gmail.com:


--
nosy: +aliles

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



[issue18229] attribute headers of http.server.BaseHTTPRequestHandler sometimes does not exists

2013-06-16 Thread Jordan Szubert

New submission from Jordan Szubert:

it seems that problem is someone connecting to port 8080 with non-http client, 
could not find warning in documentation


---fragment of `less access.log`
81.172.30.254 - - [16/Jun/2013 11:36:58] ^SBitTorrent protocol^@^@^@^@^@^X^@^Ej
81.172.30.254 - - [16/Jun/2013 11:38:11] ^NU+008E^@f¸ãÄòQ;³xU+0092b^C^HÄA7
81.172.30.254 - - [16/Jun/2013 11:39:22] ^SBitTorrent protocol^@^@^@^@^@^X^@^Ej
81.172.30.254 - - [16/Jun/2013 11:40:35] ÃU+008D¬0æzU+0093zr^DU+009B2]WQ



Exception happened during processing of request from ('81.172.30.254', 63650)
Traceback (most recent call last):
  File c:\Python33\lib\socketserver.py, line 306, in _handle_request_noblock
self.process_request(request, client_address)
  File c:\Python33\lib\socketserver.py, line 332, in process_request
self.finish_request(request, client_address)
  File c:\Python33\lib\socketserver.py, line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File c:\Python33\lib\socketserver.py, line 666, in __init__
self.handle()
  File c:\Python33\lib\http\server.py, line 400, in handle
self.handle_one_request()
  File c:\Python33\lib\http\server.py, line 380, in handle_one_request
if not self.parse_request():
  File c:\Python33\lib\http\server.py, line 283, in parse_request
self.send_error(400, Bad request version (%r) % version)
  File c:\Python33\lib\http\server.py, line 428, in send_error
self.send_response(code, message)
  File c:\Python33\lib\http\server.py, line 443, in send_response
self.log_request(code)
  File c:\Users\joru\Dropbox\programowanie\demoniszcze\server\_lowerHTTP.py, 
line 30, in log_request
xff=req.headers.get('X-Forwarded-For')
AttributeError: '_HNDL_3' object has no attribute 'headers'
# _HNLD_3 derives from http.server.BaseHTTPRequestHandler

--
assignee: docs@python
components: Documentation
messages: 191264
nosy: docs@python, joru
priority: normal
severity: normal
status: open
title: attribute headers of http.server.BaseHTTPRequestHandler sometimes does 
not exists
type: behavior
versions: Python 3.3

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



[issue18197] insufficient error checking causes crash on windows

2013-06-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Closing this on the assumption the bug is in the extension. Feel free to reopen 
if further investigation shows a problem in the interpreter core.

--
nosy: +ncoghlan
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue18081] test_logging failure in WarningsTest on buildbots

2013-06-16 Thread Brett Cannon

Brett Cannon added the comment:

Seems to be fairly consistent on Windows but more random on Linux. I have also 
triggered it on my OS X machine randomly.

Can't tell if it's a timing issue or some other test doing something bad. I'm 
worried solving it is going to require taking one of the failing instance's 
list of tests and then slowly pruning it down to find the trigger (if it's not 
a timing thing).

--
nosy: +brett.cannon

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



[issue18081] test_logging failure in WarningsTest on buildbots

2013-06-16 Thread Brett Cannon

Brett Cannon added the comment:

Found the test cases to cause this::

 ./python.exe -m test test_idle test_logging

Adding Roger and Terry to see if they happen to remember any of the IDLE tests 
using logging or warnings in a way that could cause this.

P.S.: I thought we had a script somewhere which helped do a binary search for 
what tests cause a failure but I can't find it. Am I imagining things?

--
nosy: +kbk, roger.serwy, terry.reedy

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



[issue18113] Memory leak in curses.panel

2013-06-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is a problem with this patch. Py_XDECREF can execute arbitrary Python 
code and this code can call set_panel_userptr. Here is a reproducer (it causes 
segfault).

--
resolution: fixed - 
stage: committed/rejected - commit review
status: closed - open
Added file: http://bugs.python.org/file30606/userptr-segfault.py

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



[issue18113] Memory leak in curses.panel

2013-06-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And here is a patch which fixes a segfault. But I can't write a test for it.

--
keywords: +patch
Added file: http://bugs.python.org/file30607/userptr_segfault.patch

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



[issue13886] readline-related test_builtin failure

2013-06-16 Thread Brett Cannon

Brett Cannon added the comment:

Issue #18230 is another test_builtin failure related to tty tests.

--
nosy: +brett.cannon

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



[issue18230] test_builtin fails/hangs when run after test_getopt

2013-06-16 Thread Brett Cannon

New submission from Brett Cannon:

If you run test_builtin after test_getopt it will hang. If you run test_getopt 
test_socket test_builtin it will fail in all tty-related tests for input().

Not sure if this is related to issue #17734 or #13886.

--
components: Library (Lib)
messages: 191270
nosy: brett.cannon
priority: normal
severity: normal
stage: needs patch
status: open
title: test_builtin fails/hangs when run after test_getopt
type: behavior
versions: Python 3.3, Python 3.4

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



[issue17734] Failure when running test_builtin after test_genexps

2013-06-16 Thread Brett Cannon

Brett Cannon added the comment:

Issue #18230 is another test_builtin failure related to tty tests.

--
nosy: +brett.cannon

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



[issue17734] Failure when running test_builtin after test_genexps

2013-06-16 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue18230] test_builtin fails/hangs when run after test_getopt

2013-06-16 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue14015] surrogateescape largely missing from documentation

2013-06-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 55f611f55952 by Andrew Kuchling in branch '3.3':
Describe 'surrogateescape' in the documentation.
http://hg.python.org/cpython/rev/55f611f55952

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17177] Deprecate imp

2013-06-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1b8f08c4efd5 by Brett Cannon in branch 'default':
Issue #17177: The imp module is pending deprecation.
http://hg.python.org/cpython/rev/1b8f08c4efd5

--

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



[issue17177] Deprecate imp

2013-06-16 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue18176] Builtins documentation refers to old version of UCD.

2013-06-16 Thread Alexander Belopolsky

Changes by Alexander Belopolsky alexander.belopol...@gmail.com:


Added file: http://bugs.python.org/file30608/bd092995907c.diff

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



[issue18176] Builtins documentation refers to old version of UCD.

2013-06-16 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Here is what grep revealed:

$ find Doc -name \*.rst | xargs grep -n '6\.2\.0'
Doc/library/stdtypes.rst:357:   See 
http://www.unicode.org/Public/6.2.0/ucd/extracted/DerivedNumericType.txt
Doc/library/unicodedata.rst:18:this database is compiled from the `UCD version 
6.2.0
Doc/library/unicodedata.rst:19:http://www.unicode.org/Public/6.2.0/ucd`_.
Doc/library/unicodedata.rst:169:.. [#] 
http://www.unicode.org/Public/6.2.0/ucd/NameAliases.txt
Doc/library/unicodedata.rst:171:.. [#] 
http://www.unicode.org/Public/6.2.0/ucd/NamedSequences.txt

I added a note next to UNIDATA_VERSION = 6.2.0 in makeunicodedata.py script. 
The makeunicodedata.py would be a place to put code that would update the docs 
automatically, but with only two affected files I don't think this is worth the 
effort.  Chances are at least unicodedata.rst will benefit from a manual review 
to reflect any substantive changes in the UCD.

--

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



[issue18223] Refactor test_tarfile

2013-06-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Oh, sorry, I missed issue17689.

--

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



[issue18081] test_logging failure in WarningsTest on buildbots

2013-06-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

test_idle, which runs the tests in idlelib/idle_test, currently comprises 9 
test methods and perhaps 100 lines that do not, as far as I know, use warnings 
or logging. However, perhaps this has an effect:

F:\Python\dev\cpython\PCbuildpython_d -m test test_idle
[1/1] test_idle
Warning -- os.environ was modified by test_idle
Warning -- locale was modified by test_idle
1 test altered the execution environment:
test_idle

Of course, the idle test code itself does no such modification. So I have no 
idea what the warning is about or how to stop it.

F:\Python\dev\cpython\PCbuildpython_d -m test.test_idle
which runs under unittest, does not produce the warning.

The other test files that use tcl/tk/tkinter, test_tcl, test_tk, 
test_ttk_guionly, and test_ttk_textonly, produce the os.environ warning but not 
the locale warning.

I duplicated the failure with the command you gave. Substituting _tcl or _tk 
for _idle removes the error. So perhaps the locale alteration, however it 
happens, is the problem.

--

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



[issue18231] What's new in Python should explain what's new in UCD

2013-06-16 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

At the minimum, we should refer to unicode.org:

http://www.unicode.org/versions/Unicode6.1.0/#Database_Changes (for Python 3.3),
http://www.unicode.org/versions/Unicode6.2.0/#Database_Changes (for Python 3.4).

We may also want to highlight changes that directly affect python programs.  
For example addition of new characters accepted as decimal digits in UCD 6.1.0.

--
assignee: docs@python
messages: 191278
nosy: belopolsky, docs@python
priority: normal
severity: normal
status: open
title: What's new in Python should explain what's new in UCD
versions: Python 3.3, Python 3.4

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



[issue18231] What's new in Python should explain what's new in UCD

2013-06-16 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
components: +Documentation
keywords: +easy
nosy: +ezio.melotti
stage:  - needs patch
type:  - enhancement

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



[issue18231] What's new in Python should explain what's new in UCD

2013-06-16 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Here is another change that I think deserves an explicit mention in What's 
New:

Python 3.3.2
 exec('a\u17B4 = 5')
 eval('a\u17B4')
5

Python 3.2.5
 exec('a\u17B4 = 5')
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 1
a឴ = 5
   ^
SyntaxError: invalid character in identifier

--

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



  1   2   >