Looking for Python Developers for MNC Client based at Bangalore

2012-12-31 Thread vani...@bharatheadhunters.com
Requirement : Python Developer 
Work Location:Bangalore
Experience: 5-8yrs  

  
Skill Set:
1.  Excellent Python and C Programming skills
2.  Good understanding of web based protocols i.e. HTTP/REST and other web 
services.
3.  Good understanding of XML and JSON
4.  Domain Knowledge of Wireless LAN(802.11) 
5.  Good understanding of client/server architecture
6.  Socket programming using TCP/UDP in C and Python
7.  Good understanding of Linux and Windows Operating Systems

Interested resumes send updated resume to vani...@bharatheadhunters.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tarfile and usernames

2012-12-31 Thread lars
On Sun, Dec 30, 2012 at 03:07:05PM -0500, Albert Hopkins wrote:
  I can't see documented anywhere what this library does with userids and
  groupids.  I can't guarantee that the computers involved will have the
  same users and groups, and would like the archives to be extracted so
  that the files are all owned by the extracting user.

 However, it should be stated that by default (on *nix anyway) if the
 user is not root then user/groups are assigned to the user exctracting
 the file (because only root can assign userids/non-member-groups).
 The TarFile extract*() methods pretty much inherit the same behavior as
 the *nix tar command.  So if you are extracting as a non-root user, you
 should expect the same behavoir.  If you are extracting as root but
 don't want to change user/groups may have to extract it manually or
 create your own class by inheriting TarFile and overriding the .chown()
 method.

Please take a look at the second example in the Examples section of the tarfile
docs:

http://docs.python.org/2.7/library/tarfile.html#examples

It shows how to extract a subset of an archive using a generator as some kind
of filter for the extractall() method. Just rewrite the example so that every
tarinfo is patched with the required user and group name information before
being yielded:

def filter(members):
for tarinfo in members:
tarinfo.uname = root
tarinfo.gname = root
yield tarinfo

That's it.

-- 
Lars Gustäbel
l...@gustaebel.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: father class name

2012-12-31 Thread Ben Finney
Chris Rebert c...@rebertia.com writes:

 By contrast, in the first part of the *expression*
 `haha(object).theprint()`, you passed an argument (namely, `object`).
 Since __init__() wasn't expecting any arguments whatsoever, you
 therefore got an error.

Why is everyone talking about the initialiser, ‘__init__’?

When:

  haha(object).theprint()
  Traceback (most recent call last):
File stdin, line 1, in module
  TypeError: object.__new__() takes no parameters

The error is talking about the constructor, ‘__new__’.

-- 
 \  “It's dangerous to be right when the government is wrong.” |
  `\   —Francois Marie Arouet Voltaire |
_o__)  |
Ben Finney

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


Re: father class name

2012-12-31 Thread Chris Rebert
On Mon, Dec 31, 2012 at 1:23 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Chris Rebert c...@rebertia.com writes:

 By contrast, in the first part of the *expression*
 `haha(object).theprint()`, you passed an argument (namely, `object`).
 Since __init__() wasn't expecting any arguments whatsoever, you
 therefore got an error.

 Why is everyone talking about the initialiser, ‘__init__’?

 When:

  haha(object).theprint()
  Traceback (most recent call last):
File stdin, line 1, in module
  TypeError: object.__new__() takes no parameters

 The error is talking about the constructor, ‘__new__’.

Because the difference between the two (and indeed, the very purpose
of the latter) is a topic of intermediate/advanced difficulty, and the
OP appears to be a newbie.
As I stated, but your quotation omitted:
 Note: I'm oversimplifying things a bit for the sake of understandability.

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


Question about nested loop

2012-12-31 Thread Isaac Won
Hi all,
I am a very novice for Python. Currently, I am trying to read continuous 
columns repeatedly in the form of array. 
my code is like below:

import numpy as np

b = []


c = 4
f = open(text.file, r)


while c  10:
c = c + 1

for  columns in ( raw.strip().split() for raw in f ):


b.append(columns[c])

y = np.array(b, float)
print c, y


I thought that  can get the arrays of the columns[5] to [10], but I only could 
get repetition of same arrays of columns[5].

The result was something like:

5 [1 2 3 4 .., 10 9 8]
6 [1 2 3 4 .., 10 9 8]
7 [1 2 3 4 .., 10 9 8]
8 [1 2 3 4 .., 10 9 8]
9 [1 2 3 4 .., 10 9 8]
10 [1 2 3 4 .., 10 9 8]


What I can't understand is that even though c increased incrementally upto 10, 
y arrays stay same.

Would someone help me to understand this problem more?

I really appreciate any help.

Thank you,

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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Adam Tauno Williams
On Thu, 2012-12-27 at 12:01 -0800, mogul wrote:
 'Aloha!
 I'm new to python, got 10-20 years perl and C experience, all gained
 on unix alike machines hacking happily in vi, and later on in vim.
 Now it's python, and currently mainly on my kubuntu desktop.
 Do I really need a real IDE, as the windows guys around me say I do,

You don't need one.

You are crazy if you don't WANT one.

Check out geany http://www.geany.org/

-- 
Adam Tauno Williams awill...@whitemice.org

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


Re: Question about nested loop

2012-12-31 Thread Gisle Vanem

Isaac Won winef...@gmail.com wrote:


while c  10:
   c = c + 1

   for  columns in ( raw.strip().split() for raw in f ):


   b.append(columns[c])

   y = np.array(b, float)
   print c, y


I thought that  can get the arrays of the columns[5] to [10],
but I only could get repetition of same arrays of columns[5].


I don't pretend to know list comprehension very well, but 
'c' isn't incremented in the inner loop ( .. for raw in f). 
Hence you only append to columns[5].


Maybe you could use another 'd' indexer inside the inner-loop?
But there must a more elegant way to solve your issue. (I'm a
PyCommer myself).

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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Hans Mulder
On 31/12/12 12:57:59, Adam Tauno Williams wrote:
 On Thu, 2012-12-27 at 12:01 -0800, mogul wrote:
 'Aloha!
 I'm new to python, got 10-20 years perl and C experience, all gained
 on unix alike machines hacking happily in vi, and later on in vim.
 Now it's python, and currently mainly on my kubuntu desktop.
 Do I really need a real IDE, as the windows guys around me say I do,
 
 You don't need one.

+1

 You are crazy if you don't WANT one.

ITYM: you'd be crazy if you'd want one.

 Check out geany http://www.geany.org/

Don't bother: Python comes with a free IDE named IDLE.  Try it
for a few minutes, and you'll find that most of the features
that make vim so wonderful, are missing from IDLE.

Just stay with vim.

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


Re: Question about nested loop

2012-12-31 Thread Hans Mulder
On 31/12/12 11:02:56, Isaac Won wrote:
 Hi all,
 I am a very novice for Python. Currently, I am trying to read continuous
 columns repeatedly in the form of array. 
 my code is like below:
 
 import numpy as np
 
 b = [] 
 c = 4
 f = open(text.file, r)
 
 while c  10:
 c = c + 1
 
 for  columns in ( raw.strip().split() for raw in f ):
 b.append(columns[c])
 
 y = np.array(b, float)
 print c, y
 
 
 I thought that  can get the arrays of the columns[5] to [10], but I only
 could get repetition of same arrays of columns[5].
 
 The result was something like:
 
 5 [1 2 3 4 .., 10 9 8]
 6 [1 2 3 4 .., 10 9 8]
 7 [1 2 3 4 .., 10 9 8]
 8 [1 2 3 4 .., 10 9 8]
 9 [1 2 3 4 .., 10 9 8]
 10 [1 2 3 4 .., 10 9 8]
 
 
 What I can't understand is that even though c increased incrementally upto 10,
 y arrays stay same.
 
 Would someone help me to understand this problem more?

That's because the inner loop read from a file until his reaches
the end of the file.  Since you're not resetting the file pointer,
during the second and later runs of the outer loop, the inner loop
starts at the end of the file and terminates without any action.

You'd get more interesting results if you rewind the file:

import numpy as np

b = []
c = 4
f = open(text.file, r)

while c  10:
c = c + 1

f.seek(0,0)
for  columns in ( raw.strip().split() for raw in f ):
b.append(columns[c])

y = np.array(b, float)
print c, y

It's a bit inefficient to read the same file several times.
You might consider reading it just once.  For example:

import numpy as np

b = []

f = open(text.file, r)
data = [ line.strip().split() for line in f ]
f.close()

for c in xrange(5, 11):
for row in data:
b.append(row[c])

y = np.array(b, float)
print c, y


Hope this helps,

-- HansM



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


Python is awesome (Project Euler)

2012-12-31 Thread Roy Smith
If you haven't heard of it, you should check out Project Euler 
(http://projecteuler.net/).  It's a series of (currently) 408 
math-oriented programming problems, of varying degrees of difficulty.

The tie-in to this group is just how many of them are trivial in Python.  
There's a whole slew of them which become one-liners due to Python's 
long int support.  For example, http://projecteuler.net/problem=48.  
Datetime made me feel like I was cheating when I did 
http://projecteuler.net/problem=19.

When you work with something as cool as Python every day, sometimes you 
lose sight of just how awesome it is.  Thanks to everybody who has 
worked to make Python possible.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python is awesome (Project Euler)

2012-12-31 Thread Alex
Yes. Although sometimes I fear that we are becoming a society of
end-users who rely too much on the capability of our tools and fail to
take the time to understand the fundamentals upon which those tools are
based or cultivate the problem-solving skills that Project Euler
appears to be trying to hone.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python is awesome (Project Euler)

2012-12-31 Thread Grant Edwards
On 2012-12-31, Alex foo@email.invalid wrote:

 Yes. Although sometimes I fear that we are becoming a society of
 end-users who rely too much on the capability of our tools and fail to
 take the time to understand the fundamentals upon which those tools are
 based or cultivate the problem-solving skills that Project Euler
 appears to be trying to hone.

That's probably pretty much what somebody said 10K years ago when
people started to specialize in different occupations and hunters
started getting their spear-points by bartering for them with dried
meat instead of everybody flaking their own out of chunks of flint.

-- 
Grant Edwards   grant.b.edwardsYow! Being a BALD HERO
  at   is almost as FESTIVE as a
  gmail.comTATTOOED KNOCKWURST.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python is awesome (Project Euler)

2012-12-31 Thread Roy Smith
In article kbsfh5$lp4$1...@dont-email.me, Alex foo@email.invalid 
wrote:

 Yes. Although sometimes I fear that we are becoming a society of
 end-users who rely too much on the capability of our tools and fail to
 take the time to understand the fundamentals upon which those tools are
 based or cultivate the problem-solving skills that Project Euler
 appears to be trying to hone.

Over the years, my understanding of the fundamentals of computing has 
included C, assembler, microcoding, TTL logic design, transistor 
circuits, and a bit of semiconductor physics.

I could certainly build you a full-adder or a flip-flop from a pile of 
NAND gates.  I *think* I could probably cobble together a NAND gate from 
a pile of transistors (but I know I couldn't build a transistor from a 
pile of sand).  I'm very happy living at the top of the stack these days 
:-)

I guess the question is, what *is* a fundamental?  There's lots of 
stuff in Project Euler that is about picking the right algorithm.  
There's even a pair of problems which are exactly the same problem, 
except that one has a (much) larger data set.  You can solve the first 
with brute-force, but not the second.  Algorithms will always be 
fundamental.

But, is knowing how to do arbitrary precision arithmetic a fundamental?  
I don't think so.  Back with I started working with microprocessors, 
knowing how to do multi-precision addition was essential because you 
only had an 8-bit adder.  But those days are long gone.

There's a problem I just worked where you need to find the last 10 
digits of some million-digit prime.  Python's long ints don't help you 
there.  What does help you is figuring out a way to solve the problem 
that's not brute-force.  I think that's what Euler is all about.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to output to syslog before /dev/log exists?

2012-12-31 Thread yanegomi
Basically I'm trying to write a snippet of code that outputs to both syslog 
and the console at boot on a FreeBSD box, and I'm not 100% sure how to direct 
the SysLogHandler to use the dmesg buffer instead of trying to use either 
localhost:514 (and failing silently), or use /dev/log (and throwing an 
Exception at boot). Here's an example of what I was trying to use:

import logging
import logging.handlers

# ...

LOG_FORMAT = '%(name)s %(message)s'
logging.basicConfig(format=LOG_FORMAT)
logger = logging.getLogger('root')
slh = logging.handlers.SysLogHandler(address='/dev/log') # XXX: Does not work 
if /dev/log doesn't exist -- for obvious reasons.
slh.setFormatter(logging.Formatter(fmt=LOG_FORMAT))
logger.addHandler(slh)

Hints within documentation is welcome and appreciated (the terms that 
needed to be looked for on Google are failing me right now :)..).
Thanks!
-Garrett
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about nested loop

2012-12-31 Thread Isaac Won
On Monday, December 31, 2012 5:25:16 AM UTC-6, Gisle Vanem wrote:
 Isaac Won winef...@gmail.com wrote:
 
 
 
  while c  10:
 
 c = c + 1
 
  
 
 for  columns in ( raw.strip().split() for raw in f ):
 
  
 
  
 
 b.append(columns[c])
 
  
 
 y = np.array(b, float)
 
 print c, y
 
  
 
  
 
  I thought that  can get the arrays of the columns[5] to [10],
 
  but I only could get repetition of same arrays of columns[5].
 
 
 
 I don't pretend to know list comprehension very well, but 
 
 'c' isn't incremented in the inner loop ( .. for raw in f). 
 
 Hence you only append to columns[5].
 
 
 
 Maybe you could use another 'd' indexer inside the inner-loop?
 
 But there must a more elegant way to solve your issue. (I'm a
 
 PyCommer myself).
 
 
 
 --gv

Thank you for your advice.
 I agree with you and tried to increment in inner loop, but still not very 
succesful. Anyway many thanks for you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about nested loop

2012-12-31 Thread Isaac Won
On Monday, December 31, 2012 6:59:34 AM UTC-6, Hans Mulder wrote:
 On 31/12/12 11:02:56, Isaac Won wrote:
 
  Hi all,
 
  I am a very novice for Python. Currently, I am trying to read continuous
 
  columns repeatedly in the form of array. 
 
  my code is like below:
 
  
 
  import numpy as np
 
  
 
  b = [] 
 
  c = 4
 
  f = open(text.file, r)
 
  
 
  while c  10:
 
  c = c + 1
 
  
 
  for  columns in ( raw.strip().split() for raw in f ):
 
  b.append(columns[c])
 
  
 
  y = np.array(b, float)
 
  print c, y
 
  
 
  
 
  I thought that  can get the arrays of the columns[5] to [10], but I only
 
  could get repetition of same arrays of columns[5].
 
  
 
  The result was something like:
 
  
 
  5 [1 2 3 4 .., 10 9 8]
 
  6 [1 2 3 4 .., 10 9 8]
 
  7 [1 2 3 4 .., 10 9 8]
 
  8 [1 2 3 4 .., 10 9 8]
 
  9 [1 2 3 4 .., 10 9 8]
 
  10 [1 2 3 4 .., 10 9 8]
 
  
 
  
 
  What I can't understand is that even though c increased incrementally upto 
  10,
 
  y arrays stay same.
 
  
 
  Would someone help me to understand this problem more?
 
 
 
 That's because the inner loop read from a file until his reaches
 
 the end of the file.  Since you're not resetting the file pointer,
 
 during the second and later runs of the outer loop, the inner loop
 
 starts at the end of the file and terminates without any action.
 
 
 
 You'd get more interesting results if you rewind the file:
 
 
 
 import numpy as np
 
 
 
 b = []
 
 c = 4
 
 f = open(text.file, r)
 
 
 
 while c  10:
 
 c = c + 1
 
 
 
 f.seek(0,0)
 
 for  columns in ( raw.strip().split() for raw in f ):
 
 b.append(columns[c])
 
 
 
 y = np.array(b, float)
 
 print c, y
 
 
 
 It's a bit inefficient to read the same file several times.
 
 You might consider reading it just once.  For example:
 
 
 
 import numpy as np
 
 
 
 b = []
 
 
 
 f = open(text.file, r)
 
 data = [ line.strip().split() for line in f ]
 
 f.close()
 
 
 
 for c in xrange(5, 11):
 
 for row in data:
 
 b.append(row[c])
 
 
 
 y = np.array(b, float)
 
 print c, y
 
 
 
 
 
 Hope this helps,
 
 
 
 -- HansM

Hi Hans,

I appreciate your advice and kind tips.

The both codes which you gave seem pretty interesting.

Both look working for incrementing inner loop number, but the results of y are 
added repeatedly such as [1,2,3],[1,2,3,4,5,6], [1,2,3,4,5,6,7,8,9]. Anyhow, 
really thank you for your help and I will look at this problem more in detail.

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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Ben Finney
Hans Mulder han...@xs4all.nl writes:

 Don't bother: Python comes with a free IDE named IDLE.

And any decent Unix-alike (most OSen apart from Windows) comes with its
own IDE: the shell, a good text editor (Vim or Emacs being the primary
candidates), and a terminal multiplexor (such as ‘tmux’ or GNU Screen).

Learning to use that development environment will benefit you far more
than any language-specific tool.

-- 
 \   “I bought some powdered water, but I don't know what to add.” |
  `\—Steven Wright |
_o__)  |
Ben Finney

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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Chris Angelico
On Tue, Jan 1, 2013 at 9:46 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Hans Mulder han...@xs4all.nl writes:

 Don't bother: Python comes with a free IDE named IDLE.

 And any decent Unix-alike (most OSen apart from Windows) comes with its
 own IDE: the shell, a good text editor (Vim or Emacs being the primary
 candidates), and a terminal multiplexor (such as ‘tmux’ or GNU Screen).

 Learning to use that development environment will benefit you far more
 than any language-specific tool.

And more than that: Learning to use that development environment gives
you the flexibility to swap out components individually. The shell
could be one of several (though bash seems to be the most popular),
the editor is one of many, and there are a good few options for
terminal arrangement (tmux, screen, gnome-terminal, etc). So what if
you decide you don't like vim OR emacs - you can still use the Unix
IDE with some other editor. Most IDEs don't have that facility.

It's a question of freedom. Would you let someone else choose what
shoes you're allowed to wear? Then why cede over the choice of
development software? No matter how awesome those shoes are, it's an
unnecessary restriction in freedom.

Of course, you're free to use an IDE if you want to, too. I don't see
much point in it, but if that's how you swing, go for it.

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


Considering taking a hammer to the computer...

2012-12-31 Thread worldsbiggestsabresfan
Hey :) 

I'm trying to help my son with an assignment and spending hours making an inch 
of progress.  I know nothing about programming and I'm trying to learn, on my 
own, at a rate faster than possible. I would love a little help!

My son is taking an introductory course and his assignment is to use the loops 
for and while to create a program which calculates a hotel's occupancy rate. He 
has managed all of the inputs but needs help with the following:

1) The first question asked is how many floors are in the hotel - and then the 
questions are asked floor by floor.  We can't figure out how to get the program 
to stop questioning when the number of floors is reached.

2) He has programmed specific calculations for each floor, and now needs to 
have  calculations for the entire hotel based on the input about each floor.

Here is what he has done so far:


#This program will calculate the occupancy rate of a hotel
floor_number = 0


number_of_floors = int(input(How many floors are in the hotel?: ))
while number_of_floors  1:
print (Invalid input!) 
number_of_floors = input(Enter the number of floors in the hotel: ) 
while number_of_floors  1:
floor_number = floor_number + 1
print()
print (For floor #,floor_number) 
rooms_on_floor = int(input(How many rooms are on the floor ?:  ))
while rooms_on_floor  10:
print (Invalid input!) 
rooms_on_floor = int(input(Enter the number of rooms on floor: ))

occupied_rooms = int(input(How many rooms on the floor are occupied?: ))

#CALCULATE OCCUPANCY RATE FOR FLOOR
occupancy_rate = occupied_rooms / rooms_on_floor
print (The occupancy rate for this floor is ,occupancy_rate)



The following is what we believe needs to go in the program at the end except 
we can't figure out how to calculate it and make it all work :/ (alot of the 
terms have nothing at all to identify them yet...) 

hotel_occupancy = total_occupied / total_rooms
print (The occupancy rate for this hotel is ,hotel_occupancy)
print (The total number of rooms at this hotel is ,total_rooms)
print (The number of occupied rooms at this hotel is ,total_occupied)
vacant_rooms = total_rooms - total_occupied
print (The number of vacant rooms at this hotel is ,vacant_rooms)

We've searched and read and we found things about the break and pass 
commands but his teacher will not allow them because they haven't been taught 
yet.  

If you have any ideas and can take a minute to help, that would be great :)

Thank you!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Chris Angelico
On Tue, Jan 1, 2013 at 10:42 AM,  worldsbiggestsabres...@gmail.com wrote:
 while number_of_floors  1:
 floor_number = floor_number + 1
 print()
 print (For floor #,floor_number)
 rooms_on_floor = int(input(How many rooms are on the floor ?:  ))
 while rooms_on_floor  10:
 print (Invalid input!)
 rooms_on_floor = int(input(Enter the number of rooms on floor: ))

You have a loop here that can never terminate, because
number_of_floors never changes.

There are a couple of solutions to this. One would be to compare
floor_number to number_of_floors, and stop the loop once the one
exceeds the other; another (and more Pythonic) way would be to use a
'for' loop, and iterate over the range of numbers from 1 to the number
of floors. See if your son has learned about range(), if so he should
be able to figure it out from that clue.

One tip: When you're asking a question like this, mention what Python
version you're using. I'm guessing it's Python 3.something, but that
might not be right. If it is indeed Python 3, then the repeated
question here will be a problem:

number_of_floors = int(input(How many floors are in the hotel?: ))
while number_of_floors  1:
print (Invalid input!)
number_of_floors = input(Enter the number of floors in the hotel: )

Note the difference between the two request lines (other than the
prompt, which is insignificant). The second time around, you're not
turning it into an integer, so that will crash (in Python 3) with the
error that strings and integers aren't ordered (that is, that it makes
no sense to ask whether a string is less than the integer 1). Python
2, on the other hand, will behave very differently here, as input()
has a quite different meaning (and one that you almost certainly do
NOT want).

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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Chris Angelico
On Tue, Jan 1, 2013 at 10:42 AM,  worldsbiggestsabres...@gmail.com wrote:
 Hey :)

Oh, and another tip. Threatening violence to your computer is unlikely
to make it change its ways, and it certainly isn't a helpful subject
line :)

All the best.

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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread xDog Walker
On Monday 2012 December 31 14:46, Ben Finney wrote:
 “I bought some powdered water, but I don't know what to add.”

Suggest to Stephen Wright to add hot coffee.

-- 
Yonder nor sorghum stenches shut ladle gulls stopper torque wet 
strainers.

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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef

On 12/31/2012 06:42 PM, worldsbiggestsabres...@gmail.com wrote:

Hey :)


 I'm trying to help my son with an assignment and spending hours 
making an inch of progress. I know nothing about programming and I'm 
trying to learn, on my own, at a rate faster than possible. I would love 
a little help!


 My son is taking an introductory course and his assignment is to use 
the loops for and while to create a program which calculates a hotel's 
occupancy rate. He has managed all of the inputs but needs help with 
the following:


 1) The first question asked is how many floors are in the hotel - and 
then the questions are asked floor by floor. We can't figure out how to 
get the program to stop questioning when the number of floors is reached.


 2) He has programmed specific calculations for each floor, and now 
needs to have calculations for the entire hotel based on the input about 
each floor.



 Here is what he has done so far:


 #This program will calculate the occupancy rate of a hotel
 floor_number = 0


 number_of_floors = int(input(How many floors are in the hotel?: ))
 while number_of_floors  1:
 print (Invalid input!)
 number_of_floors = input(Enter the number of floors in the hotel: )
 while number_of_floors  1:
 floor_number = floor_number + 1
 print()
 print (For floor #,floor_number)
 rooms_on_floor = int(input(How many rooms are on the floor ?:  ))
 while rooms_on_floor  10:
 print (Invalid input!)
 rooms_on_floor = int(input(Enter the number of rooms on floor: ))

 occupied_rooms = int(input(How many rooms on the floor are 
occupied?: ))


 #CALCULATE OCCUPANCY RATE FOR FLOOR
 occupancy_rate = occupied_rooms / rooms_on_floor
 print (The occupancy rate for this floor is ,occupancy_rate)



 The following is what we believe needs to go in the program at the 
end except we can't figure out how to calculate it and make it all work 
:/ (alot of the terms have nothing at all to identify them yet...)


 hotel_occupancy = total_occupied / total_rooms
 print (The occupancy rate for this hotel is ,hotel_occupancy)
 print (The total number of rooms at this hotel is ,total_rooms)
 print (The number of occupied rooms at this hotel is ,total_occupied)
 vacant_rooms = total_rooms - total_occupied
 print (The number of vacant rooms at this hotel is ,vacant_rooms)

 We've searched and read and we found things about the break and 
pass commands but his teacher will not allow them because they haven't 
been taught yet.


 If you have any ideas and can take a minute to help, that would be 
great :)


 Thank you!


Hi! First I want to note that this task would be easier and better to do
with a break statement, so it's quite unfortunate that the teacher did
not cover the right tools (and very basic ones, in fact) and yet given
this task.

Another question: are you allowed to use functions? (I'm guessing not).

You can do this task much easier if you write it out in pseudo code
before you go to python code. For example, to convert your existing
code to pseudo code:

* set floor_number to 0
* get number of floors from the user

* as long as number of floors is less than 1:
* print invalid input
* get number of floors from the user

* as long as number of floors is more than 1:
* increment floor_number

* get number of rooms
* as long as number of rooms is less than 10:
* get number of rooms

* get occupied_rooms
* occupancy_rate = occupied rooms / number of rooms

* how do we keep track of total rooms and total occupied rooms here??


Does it make it easier to think about the logic of the program?

 - mitya



--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef

On 12/31/2012 07:29 PM, Mitya Sirenef wrote:



Hi! First I want to note that this task would be easier and better to do
with a break statement, so it's quite unfortunate that the teacher did
not cover the right tools (and very basic ones, in fact) and yet given
this task.

Another question: are you allowed to use functions? (I'm guessing not).

You can do this task much easier if you write it out in pseudo code
before you go to python code. For example, to convert your existing
code to pseudo code:

* set floor_number to 0
* get number of floors from the user

* as long as number of floors is less than 1:
* print invalid input
* get number of floors from the user

* as long as number of floors is more than 1:
* increment floor_number

* get number of rooms
* as long as number of rooms is less than 10:
* get number of rooms

* get occupied_rooms
* occupancy_rate = occupied rooms / number of rooms

* how do we keep track of total rooms and total occupied rooms here??


Does it make it easier to think about the logic of the program?

 - mitya




I forgot to add this:

question = How many floors are in the hotel?: 
number_of_floors = int(input(question))

while number_of_floors  1:
print(Invalid input!)
number_of_floors = int(input(question))


It's easier to save the question in a variable and use it two
times (and do the same in the next loop); it's not clear
why/if the questions should be different as you're asking
the user for the same thing.

 -m

--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Vlastimil Brom
2013/1/1  worldsbiggestsabres...@gmail.com:
 Hey :)

 I'm trying to help my son with an assignment and spending hours making an 
 inch of progress.  I know nothing about programming and I'm trying to learn, 
 on my own, at a rate faster than possible. I would love a little help!

 My son is taking an introductory course and his assignment is to use the 
 loops for and while to create a program which calculates a hotel's occupancy 
 rate. He has managed all of the inputs but needs help with the following:

 1) The first question asked is how many floors are in the hotel - and then 
 the questions are asked floor by floor.  We can't figure out how to get the 
 program to stop questioning when the number of floors is reached.

 2) He has programmed specific calculations for each floor, and now needs to 
 have  calculations for the entire hotel based on the input about each floor.

 Here is what he has done so far:


 #This program will calculate the occupancy rate of a hotel
 floor_number = 0


 number_of_floors = int(input(How many floors are in the hotel?: ))
 while number_of_floors  1:
 print (Invalid input!)
 number_of_floors = input(Enter the number of floors in the hotel: )
 while number_of_floors  1:
 floor_number = floor_number + 1
 print()
 print (For floor #,floor_number)
 rooms_on_floor = int(input(How many rooms are on the floor ?:  ))
 while rooms_on_floor  10:
 print (Invalid input!)
 rooms_on_floor = int(input(Enter the number of rooms on floor: ))

 occupied_rooms = int(input(How many rooms on the floor are occupied?: ))

 #CALCULATE OCCUPANCY RATE FOR FLOOR
 occupancy_rate = occupied_rooms / rooms_on_floor
 print (The occupancy rate for this floor is ,occupancy_rate)



 The following is what we believe needs to go in the program at the end except 
 we can't figure out how to calculate it and make it all work :/ (alot of the 
 terms have nothing at all to identify them yet...)

 hotel_occupancy = total_occupied / total_rooms
 print (The occupancy rate for this hotel is ,hotel_occupancy)
 print (The total number of rooms at this hotel is ,total_rooms)
 print (The number of occupied rooms at this hotel is ,total_occupied)
 vacant_rooms = total_rooms - total_occupied
 print (The number of vacant rooms at this hotel is ,vacant_rooms)

 We've searched and read and we found things about the break and pass 
 commands but his teacher will not allow them because they haven't been taught 
 yet.

 If you have any ideas and can take a minute to help, that would be great :)

 Thank you!
 --
 http://mail.python.org/mailman/listinfo/python-list

Hi,
if break isn't allowed, you can add the appropriate condition to the
while construct
 i=0
 while i  4:
... print i
... i = i + 1
...
0
1
2
3


or you can use the for-loops based on the previously determined number
of the floors and rooms respectively.
let's hope range(...) is allowed - the usual idiom is e.g.:
 for i in range(4):
... print i
...
0
1
2
3


Note, that the indexing in python is zero-based (which also applies
for range by default); the range doesn't include the given upper
stop-value
http://docs.python.org/release/3.3.0/library/stdtypes.html#range

Depending on the assignment and on the interpretation of the
ground-floor (zeroth-floor), you may need to account for this (you
can also pass the start value to range(...) ).

the totals can be collected simply by incrementing the respective
numbers with each floor within the loop.

hth,
  vbr
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WWE Divas Nude, plus Nude Diva full open video, lita, mickey more....

2012-12-31 Thread wesbass2013
On Sunday, May 3, 2009 5:37:33 AM UTC-7, Mickey wrote:
 Wwe,World Wrestling Entertainment,WWE Smackdow,WWE RAW,WWE Divas,WWE
 Divas Nude, plus Nude Diva Wallpaper and WWE Nude Diva Screensavers,
 full open video,lita,mickey  more
 http://www.earningzones.com/wwe_divas

thats would be great
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Considering taking a hammer to the computer...

2012-12-31 Thread worldsbiggestsabresfan
Here is what I've learned:

1) There's a bunch of extremely helpful and wonderful people here.

2) There's a bunch of very intelligent people here.

3) I still don't have any idea what I'm doing.

4) It's New Year's Eve and I'm trying to learn Python...?  

I'm going to read all of this over and over until it makes sense to me!  Thank 
you all SO MUCH!!!  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Mitya Sirenef

On 12/31/2012 08:30 PM, worldsbiggestsabres...@gmail.com wrote:

Here is what I've learned:

1) There's a bunch of extremely helpful and wonderful people here.

2) There's a bunch of very intelligent people here.

3) I still don't have any idea what I'm doing.

4) It's New Year's Eve and I'm trying to learn Python...?

I'm going to read all of this over and over until it makes sense to me!  Thank 
you all SO MUCH!!!



You're welcome and don't hesitate to ask follow-up question,
Happy new year!

 - mitya


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

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


Re: dict comprehension question.

2012-12-31 Thread Steven D'Aprano
On Sat, 29 Dec 2012 18:56:57 -0500, Terry Reedy wrote:

 On 12/29/2012 2:48 PM, Quint Rankid wrote:
 
 Given a list like:
 w = [1, 2, 3, 1, 2, 4, 4, 5, 6, 1]
 I would like to be able to do the following as a dict comprehension. 
 a = {}
 for x in w:
  a[x] = a.get(x,0) + 1
 results in a having the value:
 {1: 3, 2: 2, 3: 1, 4: 2, 5: 1, 6: 1}
 
 Let me paraphrase this: I have nice, clear, straightforward,
 *comprehensible* code that I want to turn into an incomprehensible mess
 with a 'comprehension. That is the ironic allure of comprehensions.

But... but... one liner! ONE LINNR Won't somebody think 
of the lines I'll save

*wink*


In case it's not obvious, I'm 100% agreeing with Terry here. List comps 
and dict comps are wonderful things, but they can't do everything, and 
very often even if they can do something they shouldn't because it makes 
the code inefficient or unreadable.

There's nothing wrong with a two or three liner.



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


Re: father class name

2012-12-31 Thread Steven D'Aprano
On Mon, 31 Dec 2012 20:23:44 +1100, Ben Finney wrote:

 Chris Rebert c...@rebertia.com writes:
 
 By contrast, in the first part of the *expression*
 `haha(object).theprint()`, you passed an argument (namely, `object`).
 Since __init__() wasn't expecting any arguments whatsoever, you
 therefore got an error.
 
 Why is everyone talking about the initialiser, ‘__init__’?
 
 When:
 
  haha(object).theprint()
  Traceback (most recent call last):
File stdin, line 1, in module
  TypeError: object.__new__() takes no parameters
 
 The error is talking about the constructor, ‘__new__’.


Good point.

I think we do a disservice to newbies when we (inadvertently) discourage 
them from reading the tracebacks generated by an error. The traceback 
clearly talks about a __new__ method.

I don't believe that talking about the constructor __new__ is so 
complicated that we should ignore the actual error and go of on a wild-
goose chase about the initialiser __init__, especially since adding an 
__init__ method to the class *won't solve the problem*.

Sorry Chris, I think you dropped the ball on this one and gave an overtly 
misleading answer :-(



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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Steven D'Aprano
On Sat, 29 Dec 2012 14:00:23 -0500, Mitya Sirenef wrote:

 I think the general idea is that with editors like Vim you don't get
 distracted by having to do some kind of an editor task, letting you keep
 your full attention on the code logic. For instance, if I need to change
 a block inside parens, I type ci) (stands for change inside parens),
 while with a regular editor I'd have to do it manually and by the time
 I'm done, I'd forget the bigger picture of what I'm doing with the code.

See, by the time I remembered what obscure (to me) command to type, or 
searched the help files and the Internet, I'd have forgotten what the 
hell it was I was trying to do. Well, almost. My memory is not quite that 
bad, but it would certainly be a much bigger disruption to my coding than 
just doing the edit by hand.

I do love the power of command line tools, but I think that for rich 
applications like editors, the interface is so clunky that I'd rather use 
a less-powerful editor, and do more editing manually, than try to 
memorize hundreds of commands.

With a GUI app, I can run the mouse over the menus and see a high-level 
overview of everything the app can do in a matter of a second or two. 
(Perhaps three or five seconds if the app over-uses hierarchical menus.) 
But with a text interface, commands are much less discoverable. I can 
also use *spacial* memory to zero in on commands much more easily than 
verbal memory -- I have no idea whether the command I want is called 
Spam or Ham or Tinned Bully Beef, but I know it's in the top 
quarter of the Lunch menu, and I will recognise it when I see it.

On the other hand, it's a lot harder to use a GUI app over a slow SSH 
connection to a remote machine in a foreign country over a flaky link 
than it is to use a command line or text-interface app.


 Another example: ap stands for indent a paragraph (separated by blank
 lines). And there are many dozens if not hundreds such commands that
 let you stay focused on the logic of your code.

Ah yes, the famous a for indent mnemonic. *wink*


 The trade-off, of course, is that you have to remember all (or most) of
 the commands, but I figured if I spend the next 20-30+ years programming
 in some version of Vim, it's well worth the initial investment.
 
 By the way, to help me remember the commands, I wrote a small script
 that lets me type in a few characters of a command or its description
 and filters out the list of matching commands. It really helps,
 especially when I change a lot of my mappings.

It seems to me, that by the time I would have searched for the right 
command to use, decided which of the (multiple) matching commands is the 
right one, then used the command, it would have been quicker and less 
distracting to have just done the editing by hand. But now I'm just 
repeating myself.



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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Modulok
 I'm trying to help my son with an assignment and spending hours making an
 inch of progress.  I know nothing about programming and I'm trying to learn,
 on my own, at a rate faster than possible. I would love a little help!

 My son is taking an introductory course and his assignment is to use the
 loops for and while to create a program which calculates a hotel's occupancy
 rate. He has managed all of the inputs but needs help with the following:

 1) The first question asked is how many floors are in the hotel - and then
 the questions are asked floor by floor.  We can't figure out how to get the
 program to stop questioning when the number of floors is reached.

 2) He has programmed specific calculations for each floor, and now needs to
 have  calculations for the entire hotel based on the input about each
 floor.

 Here is what he has done so far:


 #This program will calculate the occupancy rate of a hotel
 floor_number = 0


 number_of_floors = int(input(How many floors are in the hotel?: ))
 while number_of_floors  1:
 print (Invalid input!)
 number_of_floors = input(Enter the number of floors in the hotel: )
 while number_of_floors  1:
 floor_number = floor_number + 1
 print()
 print (For floor #,floor_number)
 rooms_on_floor = int(input(How many rooms are on the floor ?:  ))
 while rooms_on_floor  10:
 print (Invalid input!)
 rooms_on_floor = int(input(Enter the number of rooms on floor: ))

 occupied_rooms = int(input(How many rooms on the floor are occupied?:
 ))

 #CALCULATE OCCUPANCY RATE FOR FLOOR
 occupancy_rate = occupied_rooms / rooms_on_floor
 print (The occupancy rate for this floor is ,occupancy_rate)



 The following is what we believe needs to go in the program at the end
 except we can't figure out how to calculate it and make it all work :/ (alot
 of the terms have nothing at all to identify them yet...)

 hotel_occupancy = total_occupied / total_rooms
 print (The occupancy rate for this hotel is ,hotel_occupancy)
 print (The total number of rooms at this hotel is ,total_rooms)
 print (The number of occupied rooms at this hotel is ,total_occupied)
 vacant_rooms = total_rooms - total_occupied
 print (The number of vacant rooms at this hotel is ,vacant_rooms)

 We've searched and read and we found things about the break and pass
 commands but his teacher will not allow them because they haven't been
 taught yet.

 If you have any ideas and can take a minute to help, that would be great :)

 Thank you!


Here's your program with some extra comments to get you started:

#This program will calculate the occupancy rate of a hotel
floor_number = 0


number_of_floors = int(input(How many floors are in the hotel?: ))
while number_of_floors  1:
print (Invalid input!)

number_of_floors = input(Enter the number of floors in the hotel: )
# Remember you need to make sure this is an int, just like before.
# number_of_floors = int(input(Enter the number of floors
in the hotel: )) Right now it's a string.


while number_of_floors  1:
# This loop runs forever, as number_of_floors never changes. You need
# to do something to `number_of_floors` such as de-increment it e.g:
# `number_of_floors -= 1`, that way we will *eventually* have
# number_of_floors less than 1, thus stopping the loop. A better
# idea would be to use a `for` loop instead of the above `while`
# loop. For example::
#
#   for i in range(number_of_floors):
#   # blah... do something for each floor. This loop
auto-terminates.
#

floor_number = floor_number + 1
print()
print (For floor #,floor_number)
rooms_on_floor = int(input(How many rooms are on the floor ?:  ))

while rooms_on_floor  10:
print (Invalid input!)
# You might consider telling your user why their input is
# invalid. e.g: rooms on floor must be greater than 10.

rooms_on_floor = int(input(Enter the number of rooms on floor: ))


occupied_rooms = int(input(How many rooms on the floor are
occupied?: ))

#CALCULATE OCCUPANCY RATE FOR FLOOR
occupancy_rate = occupied_rooms / rooms_on_floor
print (The occupancy rate for this floor is ,occupancy_rate)


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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Steven D'Aprano
On Sun, 30 Dec 2012 09:30:10 +1100, Chris Angelico wrote:

 Absolutely! Though it's roughly as good to have the current cursor
 position shown in a status line somewhere, and takes up less real
 estate. But yes, vital to be able to see that. Even when I'm sitting
 *right next to* my boss and communicating verbally, I'll talk about the
 code by quoting line numbers. Let me explain. (No, there is too much.
 Let me sum up.) Pull up foobar dot jay ess and go to line 254-ish - see
 how the frobnosticator always gets called with a quuxed argument?

I call shenanigans :-P

I don't expect that you keep in your head the line numbers (even the line 
numbers-ish) of interesting or pertinent features of your code, 
*especially* while the code is in active development and the line numbers 
are rapidly changing. I think it is far more likely that you keep 
function, class or method names in your head (after all, you are 
presumably reading and writing those names very often), and when you want 
to demonstrate some feature, you *first* look it up by higher-level 
object (let's see the frob_quux function) to get the line number.

Assuming that your functions and methods are not obnoxiously huge, I 
think having a good class browser which lets you jump directly to 
functions or methods is *far* more useful than line numbers, in this 
context.


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


Re: ignore case only for a part of the regex?

2012-12-31 Thread Steven D'Aprano
On Sun, 30 Dec 2012 10:20:19 -0500, Roy Smith wrote:

 The way I would typically do something like this is build my regexes in
 all lower case and .lower() the text I was matching against them.  I'm
 curious what you're doing where you want to enforce case sensitivity in
 one part of a header, but not in another.

Well, sometimes you have things that are case sensitive, and other things 
which are not, and sometimes you need to match them at the same time. I 
don't think this is any more unusual than (say) wanting to match an 
otherwise lowercase word whether or not it comes at the start of a 
sentence:

[Pp]rogramming

is conceptually equivalent to match case-insensitive `p`, and case-
sensitive `rogramming`.


By the way, although there is probably nothing you can (easily) do about 
this prior to Python 3.3, converting to lowercase is not the right way to 
do case-insensitive matching. It happens to work correctly for ASCII, but 
it is not correct for all alphabetic characters.


py 'Straße'.lower()
'straße'
py 'Straße'.upper()
'STRASSE'


The right way is to casefold first, then match:

py 'Straße'.casefold()
'strasse'


Curiously, there is an uppercase ß in old German. In recent years some 
typographers have started using it instead of SS, but it's still rare, 
and the official German rules have ß transform into SS and vice versa. 
It's in Unicode, but few fonts show it:

py unicodedata.lookup('LATIN CAPITAL LETTER SHARP S')
'ẞ'



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


Re: New to python, do I need an IDE or is vim still good enough?

2012-12-31 Thread Chris Angelico
On Tue, Jan 1, 2013 at 2:55 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, 30 Dec 2012 09:30:10 +1100, Chris Angelico wrote:

 Absolutely! Though it's roughly as good to have the current cursor
 position shown in a status line somewhere, and takes up less real
 estate. But yes, vital to be able to see that. Even when I'm sitting
 *right next to* my boss and communicating verbally, I'll talk about the
 code by quoting line numbers. Let me explain. (No, there is too much.
 Let me sum up.) Pull up foobar dot jay ess and go to line 254-ish - see
 how the frobnosticator always gets called with a quuxed argument?

 I call shenanigans :-P

 I don't expect that you keep in your head the line numbers (even the line
 numbers-ish) of interesting or pertinent features of your code,
 *especially* while the code is in active development and the line numbers
 are rapidly changing. I think it is far more likely that you keep
 function, class or method names in your head (after all, you are
 presumably reading and writing those names very often), and when you want
 to demonstrate some feature, you *first* look it up by higher-level
 object (let's see the frob_quux function) to get the line number.

Neither. You're correct that I don't memorize line numbers; but the
point of them was not to synchronize a screen with a brain, but to
synchronize two screens. So you're also correct that I look it up to
get the line number. But I'm not locating a function; if I wanted
that, I'd use that. No, I'm pointing to a specific line of code.

 Assuming that your functions and methods are not obnoxiously huge, I
 think having a good class browser which lets you jump directly to
 functions or methods is *far* more useful than line numbers, in this
 context.

They're not obnoxiously huge, but even twenty lines is too coarse when
you're trying to explain one line of code. Way too coarse. I want to
pinpoint what I'm talking about.

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


Re: Considering taking a hammer to the computer...

2012-12-31 Thread Tim Chase

On 12/31/12 19:30, worldsbiggestsabres...@gmail.com wrote:

Here is what I've learned:

[snip]

4) It's New Year's Eve and I'm trying to learn Python...?


Can't think of a much better way to spend New Year's Eve, unless 
you're learning Python while also watching fireworks. :-)


-tkc




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


[issue13951] Document that Seg Fault in .so called by ctypes causes the interpreter to Seg Fault

2012-12-31 Thread Georg Brandl

Georg Brandl added the comment:

LGTM.

--

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



[issue14516] test_tools assumes BUILDDIR=SRCDIR

2012-12-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

2.7 works as well. 

Roumen: what doesn't work and how can we reproduce that?

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - pending

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



[issue16824] typo in test

2012-12-31 Thread Stefan Behnel

New submission from Stefan Behnel:

Line 522 in test file Lib/test/test_pep380.py says:

trace.append(Should not have yielded:, y)

However, 'trace' is a list and list.append() only takes one parameter, so this 
should read:

trace.append(Should not have yielded: %r % y)

I noticed it because Cython's type analysis refuses to compile this. This line 
is just a failure guard and is never reached in the normal test execution, 
that's why it doesn't show in CPython's test runs.

--
components: Tests
messages: 178653
nosy: scoder
priority: normal
severity: normal
status: open
title: typo in test
type: compile error
versions: Python 3.3, Python 3.4

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



[issue15075] XincludeTest failure in test_xml_etree

2012-12-31 Thread Stefan Behnel

Stefan Behnel added the comment:

If runtime checks are needed to prevent mixing arbitrary objects into the tree, 
then I don't think they should be considered too costly.

I agree with Florent that this is worth reopening. It doesn't look like a 
Tests bug to me rather a Lib/XML bug.

--
nosy: +scoder

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28504/python-2.7-issue1674555.patch

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28505/python-3.2-issue1674555.patch

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28506/python-3.3-issue1674555.patch

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28507/python-3.4-issue1674555.patch

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Removed file: http://bugs.python.org/file20583/python-3.2-issue1674555.patch

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Removed file: http://bugs.python.org/file20584/python-2.7-issue1674555.patch

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



[issue16659] Pure Python implementation of random

2012-12-31 Thread Stefan Behnel

Stefan Behnel added the comment:

FWIW, PyPy has an (R)Python implementation already:

https://bitbucket.org/pypy/pypy/src/default/pypy/rlib/rrandom.py

--
nosy: +scoder

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




[issue16824] typo in test

2012-12-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-31 Thread Charles-François Natali

Charles-François Natali added the comment:

The patch looks good, however there's something really bothering me:
in issue #14635, the same type of patch was applied to telnetlib,
here, it's multiprocessing and AFAICT, any single use of select() in
the standard library is subject to this FD_SETSIZE limitation.
That why I think it could probably be a good idea to expose a
high-level selector object in the select module, which would use the
right syscall transparently (e.g. select, poll or /dev/poll), with a
unified API. This would make writing portable and efficient I/O
multiplexing code much easier, not only in the stdlib, but also for
end-users.

--

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



[issue16824] typo in test

2012-12-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9472928af085 by Serhiy Storchaka in branch '3.3':
Issue #16824: Fix a failure guard in the never reached in the normal test 
execution code in test_pep380.
http://hg.python.org/cpython/rev/9472928af085

New changeset 5ef7d9d6 by Serhiy Storchaka in branch 'default':
Issue #16824: Fix a failure guard in the never reached in the normal test 
execution code in test_pep380.
http://hg.python.org/cpython/rev/5ef7d9d6

--
nosy: +python-dev

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



[issue16824] typo in test

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed. Thank you, Stefan. I will be glad to see new bugs which you will found 
with Cython.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type: compile error - behavior

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The fileno parameter was added in the changeset 8e062e572ea4. It was mentioned 
in comments at the top of Modules/socketmodule.c, but not in the documentation 
or docstrings (nor for _socket.socket, nor for socket.socket).

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, pitrou, serhiy.storchaka
type:  - enhancement

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Removed file: http://bugs.python.org/file16630/python-LDCXXSHARED.patch

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

I attach updated patches for distutils in case somebody wants to use them. (I 
privately update them once per week.)

--

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


--
keywords: +patch
Added file: http://bugs.python.org/file28508/python-2.7-distutils-C++.patch

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28509/python-3.2-distutils-C++.patch

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28510/python-3.3-distutils-C++.patch

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



[issue1222585] C++ compilation support for distutils

2012-12-31 Thread Arfrever Frehtes Taifersar Arahesis

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


Added file: http://bugs.python.org/file28511/python-3.4-distutils-C++.patch

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



[issue16320] Establish order in bytes/string dependencies

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The cleanup of BYTESTR_DEPS and UNICODE_DEPS seems reasonable, but can you
 explain the rationale behind removing the additional dependencies on
 formatter_unicode.c?

This question already was asked by Antoine on IRC.

Because now Python/formatter_unicode.c depends only on headers included in 
PYTHON_HEADERS. A special rule doesn't needed.

 Why were those dependencies ever needed (I can't see
 the dependencies from reading formatter_unicode.c and its included
 headers)?

Perhaps this is an artifact. This dependency was added in r61057 and 
fce5af5ce16a by Christian Heimes.

--
nosy: +christian.heimes

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



[issue16821] bundlebuilder broken in 2.7

2012-12-31 Thread Barry Alan Scott

Barry Alan Scott added the comment:

Why not use IDLE? Workbench is a lot of code and dependencies.

I expect that it works because idle.app was created using the --no-zipimport 
option that is new in 2.7.

However with zip import the code is badly broken.

Build IDLE.app with zip import and you should reproduce the bug.

Have you code inspected the module as I suggested to review the new code?

_getSiteCode is clearly wrong. The if is backwards and no else.

The following inserts are in the wrong order:

if %(optimize)s:
sys.argv.insert(1, '-O')

sys.argv.insert(1, mainprogram)

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-31 Thread Georg Brandl

Georg Brandl added the comment:

 20+ years of Python success suggest this isn't a problem that needs solving.

That reasoning could be applied to almost all open tracker issues.

 Likewise, Linux itself doesn't preserve the original form of a chmod call.

Where would/could it do so?  C has no introspection facility equivalent to 
pydoc, which is discussed here.  In the Linux manual pages, octal literals are 
used.  Introspective tools like strace also display octal literals when 
tracing *chmod calls.

That said, I agree that this is not an issue worth solving just because of 
octal literals.  But there are more cases in which the actual signature doesn't 
represent the best way to document the function API, and if a simple solution 
can be found it would not be different from fixing a minor annoyance elsewhere 
in Python.

--

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



[issue16821] bundlebuilder broken in 2.7

2012-12-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

It probably works because IDLE.app only uses the stdlib (that is, anything 
imported from the main script is in the stdlib)

The bundlebuilder call for IDLE.app:


$(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name=IDLE \
--link-exec \
--plist=Info.plist \
--mainprogram=$(srcdir)/idlemain.py \
--iconfile=$(srcdir)/../Icons/IDLE.icns \
--resource=$(srcdir)/../Icons/PythonSource.icns \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build


I don't have time to look into this right now, maybe in a couple of weeks.

--

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The fileno argument looks like an implementation detail to me.

--
nosy: +gvanrossum

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



[issue16061] performance regression in string replace for 3.3

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 str_replace_1char.patch: why not implementing replace_1char_inplace() in
 stringlib, with one version per character type (UCS1, UCS2, UCS4)?

Because there are no benefits to do it. All three versions (UCS1, UCS2, and 
UCS4) have no any common code. The best implementation used for every kind of 
strings. For UCS1 it uses fast memchr() (findchar() has some overhead here), 
for UCS2 it uses findchar(), and for UCS4 it uses a dumb loop, because 
findchar() will be too ineffective here.

 I prefer unicode_2.patch algorithm because it's simpler: only one loop (vs
 two loops for str_replace_1char.patch, with a threshold of 10 different
 characters).

Yes, UCS1-implementation in str_replace_1char.patch is more complicated, but 
it is faster for more input strings. memchr() is more effective than a simple 
loop when the replaceable characters are rare. But when they meet often, a 
simple cycle is more efficient. The attempts counter determines how many 
characters will be checked before using memchr(). This speeds up the 
replacement in strings with frequent replacements, but a little slow down the 
replacement in strings with rare replacements. 10 is a compromise. 
str_replace_1char.patch speed up not only case when *each* character replaced, 
but when 1/2, 1/3, 1/5,... characters replaced.

 Why do you changed your algorithm? Is str_replace_1char.patch algorithm
 more efficient than unicode_2.patch algorithm? Is the speedup really
 interesting?

You can run benchmarks and compare results. str_replace_1char.patch provides 
not the best performance, but most stable results for wide sort of strings, 
and has no regressions comparing with 3.2.

--

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 The fileno argument looks like an implementation detail to me.

It has at least one potential use.  On Windows socket.detach() returns a socket 
handle but there is no documented way to close it -- os.close() will not work.  
The only way to close it that I can see (without resorting to ctypes) is with 
something like

socket.socket(fileno=handle).close()

--

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



[issue16822] execv (et al.) should invoke atexit handlers before executing new code

2012-12-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That's a good question. Conceptually it makes sense, but I wonder if programs 
currently rely on os.execv not cleaning up anything: not only it doesn't call 
atexit handlers, but it also doesn't try to shutdown the interpreter. Which can 
be handy if you are using exec() in a fork() + exec() context (I think it is 
generally recommended to use os._exit(), not sys.exit() in a forked child).

--
nosy: +neologix, pitrou
type:  - enhancement
versions: +Python 3.4 -Python 2.7, Python 3.3

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



[issue16822] execv (et al.) should invoke atexit handlers before executing new code

2012-12-31 Thread Georg Brandl

Georg Brandl added the comment:

FTR, with C's atexit(3), the handlers are not called either on exec().

--
nosy: +georg.brandl

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



[issue16822] execv (et al.) should invoke atexit handlers before executing new code

2012-12-31 Thread Charles-François Natali

Charles-François Natali added the comment:

The first reason for not calling atexit handlers upon exec() is that
it wouldn't be async-safe anymore, and could result in deadlocks.
Also, since atexit handlers are inherited upon fork(), running atexit
handlers upon exec() could result in such handlers being called
several times - something which should definitely be avoided.

Note that the atexit documentation states that handlers will only be
called in case of normal interpreter termination.

So I'm -1 on the change, the chance of breaking existing applications
is way too high.

--

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



[issue16820] configparser.ConfigParser.clean and .update bugs

2012-12-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 459a23083b66 by Łukasz Langa in branch '3.3':
Fixes `__setitem__` on parser['DEFAULT'] reported in issue #16820.
http://hg.python.org/cpython/rev/459a23083b66

New changeset f6fb5a5748f0 by Łukasz Langa in branch 'default':
Merged `parser['DEFAULT'].__setitem__` fix (issue #16820) from 3.3.
http://hg.python.org/cpython/rev/f6fb5a5748f0

--

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



[issue16820] configparser.ConfigParser.clean and .update bugs

2012-12-31 Thread Łukasz Langa

Łukasz Langa added the comment:

For the record, the bug that caused the following to be equivalent:

  parser['DEFAULT'] = {'option': 'value'} 
  parser['DEFAULT'].update({'option': 'value'})

has been fixed for 3.3.1+ only. This way it's going to be easier for users to 
reason about the fix (it was broken in 3.2.0 - 3.3.0).

Note that the bug only affected __setitem__ on the default section.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue16825] all OK!!!

2012-12-31 Thread Bernie Keimel

Changes by Bernie Keimel unowne...@gmail.com:


--
nosy: Bernie.Keimel
priority: normal
severity: normal
status: open
title: all OK!!!

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



[issue16825] all OK!!!

2012-12-31 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The patch can cause problems when either DYLD_LIBRARY_PATH or the current 
working directory contains whitepace, a better fix is:

RUNSHARED=DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}

(That is, replace the single quotes by double quotes)

--
nosy: +hynek, ned.deily, ronaldoussoren

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



[issue16803] Make test_importlib run tests under both _frozen_importlib and importlib._bootstrap

2012-12-31 Thread Brett Cannon

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


--
title: Make time_importlib run tests under both _frozen_importlib and 
importlib._bootstrap - Make test_importlib run tests under both 
_frozen_importlib and importlib._bootstrap

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



[issue16651] Find out what stdlib modules lack a pure Python implementation

2012-12-31 Thread Brett Cannon

Brett Cannon added the comment:

One thing I should say about this list of modules is please don't go nuts 
porting every single module blindly. There is always a possibility that another 
VM has already ported the code and has simply not contributed it back and so 
there is no need to write it from scratch and more just political wrangling to 
get contributions pushed upstream from other VMs. There might also be reasons 
to not worry about porting something. Always start a conversation first before 
starting a port; last thing I want is someone putting in the time to port some 
code that no one will necessarily use for a while.

--

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 It has at least one potential use.  On Windows socket.detach() returns a
 socket handle but there is no documented way to close it -- os.close()
 will not work.  The only way to close it that I can see (without resorting
 to ctypes) is with something like
 
 socket.socket(fileno=handle).close()

There is an alternative (documented) interface:

socket.fromfd(handle, socket.AF_INET, socket.SOCK_STREAM).close()

--

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



[issue16659] Pure Python implementation of random

2012-12-31 Thread Brett Cannon

Brett Cannon added the comment:

In response to Raymond:

First, Serhiy is a core developer now, so if he wants to commit this code and 
maintain it I have no objections as it doesn't detract from anything and the 
maintenance burden is his if he wants it. Whether any of us view it as the best 
use of his time or not is not our call and we can't stop him. =)

Second, while PyPy may have an RPython implementation, it's originally from 
2006, has already been patched by them twice in 2011 for bugs, and may not be 
needed by them anymore based on current performance characteristics of PyPy 
today in lieu of this code (and that's assuming they wrote the code in RPython 
originally for a specific reason compared to just needing something that 
worked, but this is all a guess w/o actually benchmarking).

Third, I can't predict future VMs and their needs. It might not be used by a VM 
today (unless PyPy starts using it for their py3k work), but who knows what the 
future holds? As I said, Serhiy already wrote the code and is the core dev who 
will maintain it if it goes in so I don't see a maintenance burden here that is 
being hoisted upon python-dev.

Fourth, I added a comment to issue #16651 to state that people should see what 
the other VMs already have and to start a conversation first before moving 
forward with a Python port to make sure no one views it as a waste of time.

--

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-31 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I know. I proposed something like that here: 
http://mail.python.org/pipermail/python-ideas/2012-May/015223.html.
In theory all the necessary pieces are already there. What's missing is an 
agreement on what the API should look like, and that's the hard part 'cause it 
should be the most generic as possible.

--

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I know. I proposed something like that here:
 http://mail.python.org/pipermail/python-ideas/2012-May/015223.html.
 In theory all the necessary pieces are already there. What's missing
 is an agreement on what the API should look like, and that's the hard
 part 'cause it should be the most generic as possible.

Well, there was a lot of bikeshedding and pie-in-the-sky arguments in
that thread, but I think the original idea of a small wrapper is good
enough. Let Guido do the grand async shakeup separately.

Also, I've changed my mind: I think select would be an ok module for
this :)

--

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



[issue16826] Don't check for PYTHONCASEOK if interpreter started with -E

2012-12-31 Thread Brett Cannon

New submission from Brett Cannon:

Importlib, when checking for PYTHONCASEOK, does not respect -E as it did in 
Python 3.2 and earlier 
(http://hg.python.org/cpython/file/0786dfc3b2b4/Python/import.c#l1933).

--
components: Interpreter Core
keywords: 3.2regression
messages: 178679
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Don't check for PYTHONCASEOK if interpreter started with -E
type: behavior
versions: Python 3.3, Python 3.4

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



[issue16827] Remove the relatively advanced content from section 2 in tutorial

2012-12-31 Thread Ramchandra Apte

New submission from Ramchandra Apte:

Most of the content in section 2 in the tutorial, 
http://docs.python.org/3/tutorial/interpreter.html , is relatively advanced and 
doesn't belong in, at least, the beginning of the tutorial.

Only 2.1. Invoking the Interpreter, and 2.2.3. Source Code Encoding should be 
in section 2. The rest can be moved outside the tutorial, or in later portions.

Thanks to Ezio Melotti for helping me overcome my laziness in filing this bug.

--
assignee: docs@python
components: Documentation
messages: 178680
nosy: docs@python, ramchandra.apte
priority: normal
severity: normal
status: open
title: Remove the relatively advanced content from section 2 in tutorial

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



[issue16827] Remove the relatively advanced content from section 2 in tutorial

2012-12-31 Thread Ezio Melotti

Ezio Melotti added the comment:

+1

--
keywords: +easy
nosy: +chris.jerdonek, ezio.melotti
stage:  - needs patch
type:  - enhancement
versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 There is an alternative (documented) interface:
 
 socket.fromfd(handle, socket.AF_INET, socket.SOCK_STREAM).close()

socket.fromfd() duplicates the handle, so that does not close the original 
handle.

--

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Hynek Schlawack

Hynek Schlawack added the comment:

bikeshed$(pwd)/bikeshed

--
stage:  - patch review
versions: +Python 3.4

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



[issue16659] Pure Python implementation of random

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't want to make a decision on the inclusion of this code. However, I will 
undertake to maintain it. I'm going to fix one algorithmic bug in current 
implementation and add C implementations for some methods which significantly 
slowed in Python implementation. This can be done without the committing of 
this patch, but the dual test the two implementations will make the code more 
reliable. Even if Python implementation is not to be used, it will help in 
maintaining C implementation.

--

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

 Hynek Schlawack added the comment:
 
 bikeshed$(pwd)/bikeshed

I'd usually agree, but this is a configure script and those shouldn't contain 
shell features invented after 1970 :-)

More seriously, a large subset of command interpolations in configure.ac use 
backticks.

--

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Hynek Schlawack

Hynek Schlawack added the comment:

I’m fine with that. My focus was fixing the ticket metadata. :)

--

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Fabian Groffen

Fabian Groffen added the comment:

re: single quotes - double quotes

I made RUNSHARED consistent (although, as you point out, less broken) with the 
other RUNSHARED assignments right above.  If suggest to tackle the issue of 
whitespace support for all RUNSHARED assignments, not just Darwin case.

re: `pwd` vs. $(pwd)

$ /bin/sh
$ echo $(pwd)
syntax error: `(' unexpected

Here again, even though Darwin/OSX may be shipped with /bin/sh being bash 
(hence above problem not existing), for consistency, using `pwd` in all 
RUNSHARED assignments is nice, IMO.

--

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



[issue16651] Find out what stdlib modules lack a pure Python implementation

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is one additional benefit. I have already implemented audioop module in 
Python, and due to this it has found many bugs in the current C implementation 
(issue16686).

--

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



[issue16783] sqlite3 accepts strings it cannot (by default) return

2012-12-31 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue6010] unable to retrieve latin-1 encoded data from sqlite3

2012-12-31 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue16591] RUNSHARED wrong for OSX no framework

2012-12-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

On 31 Dec, 2012, at 15:59, Fabian Groffen rep...@bugs.python.org wrote:

 
 Fabian Groffen added the comment:
 
 re: single quotes - double quotes
 
 I made RUNSHARED consistent (although, as you point out, less broken) with 
 the other RUNSHARED assignments right above.  If suggest to tackle the issue 
 of whitespace support for all RUNSHARED assignments, not just Darwin case.

Maybe, but whitespace supporrt on OSX is more pressing than on regular Unix 
systems because users are more likely to create directory names with whitespace 
in them. 

 
 re: `pwd` vs. $(pwd)
 
 $ /bin/sh
 $ echo $(pwd)
 syntax error: `(' unexpected
 
 Here again, even though Darwin/OSX may be shipped with /bin/sh being bash 
 (hence above problem not existing), for consistency, using `pwd` in all 
 RUNSHARED assignments is nice, IMO.

Which shell doesn't have $(command) support?  It is not a bash-ism, but is part 
of the POSIX shell definition (but wasn't present in older sh implementations).

--

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



[issue16826] Don't check for PYTHONCASEOK if interpreter started with -E

2012-12-31 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
nosy: +ncoghlan

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Indeed. In any case, if this idiom is widely used, we can't hide this parameter 
and should document it (and perhaps document this idiom).

If BDFL not want this parameter was made public, he would not have added it as 
an keyword argument. However, may be to ask him?

--

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



[issue7735] socket.create_connection() creates IPv6 DNS requests even when built with --disable-ipv6

2012-12-31 Thread Ralf Schmitt

Ralf Schmitt added the comment:

Daniel is pretty much spot on, thanks for that!

Regarding the use case: I disabled IPv6 system wide when building
packages via gentoo's USE flag. I didn't do anything in order to
configure IPv6 or remove it. My local network interface having a local
link address is a result of that.

I've been told multiple times to fix my setup. And I said multiple
times that the setup is not at fault here.

 schmir expects that --disable-ipv6 would really disable IPv6
  *everywhere* in Python, which is wrong. Python may still get IPv6
  adddresses from getaddrinfo() if the system does somehow support
  IPv6.

I did not say that. In fact I wrote in msg172729:

I didn't request that the switch disables any code that somehow deals
with IPv6. I'm just talking about that one function!


 Python may still get IPv6 adddresses from getaddrinfo() if the
 system does somehow support IPv6.

That would be nice. But that's currently not the case. see
http://bugs.python.org/issue16208

haypo, you also keep talking of an initial problem, which you assume
must be there somewhere in my network - which I try to workaround with
--disable-ipv6. There is no problem on my side that I'm trying to
fix. It's just that I have disabled IPv6 via gentoo's USE flags, since
I don't use it. I've also been telling this multiple times, I don't
know why I'm being completely ignored here.


 wont fix is the correct status for this issue: we agree that there
  is a bug, but it will not be fixed, because --disable-ipv6 is the
  wrong solution.

again. it can't be a solution since there is no problem unless this
option is being used and then there's a problem in python.

--

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



[issue7735] socket.create_connection() creates IPv6 DNS requests even when built with --disable-ipv6

2012-12-31 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy:  -pitrou

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-31 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Well, for now I'd say let's just check in this patch as-is.
I would be keen on considering this a bug and hence address the patch for 
Python 2.7, 3.2, 3.3 and 3.4.

--

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



[issue1674555] sys.path in tests contains system directories

2012-12-31 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
nosy: +ncoghlan

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-31 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 Does asyncore expose its implementation details?

I was talking about asynchat. What is supposed to change is 
asynchat.async_chat.producer_fifo attribute which is currently a 
collections.deque object.

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-31 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

BTW, the patch looks ok to me.

--

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



  1   2   >