Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon

Op 30-06-13 22:14, Νίκος schreef:

Στις 30/6/2013 10:58 μμ, ο/η Robert Kern έγραψε:

On 2013-06-30 18:24, Νίκος wrote:

Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε:


Why this when the approach to Nick the Incompetant Greek has been to
roll out the red carpet?


Your mother is incompetent who raised a brat like you.


That is not acceptable behavior on this list. Please keep the gratuitous
insults offlist.


Ι'm sorry but please put yourself into my shows,


Why should we? You, yourself have shown no willingness to put yourself
in the shoes of others. When it was pointed out your behaviour was
unacceptable, you continued just the same with no consideration of
how much you were antagonising the members of this group.


where in multiple
threads i'm still discussed and being insulted as a troll and as an
idiot and incompetent and stuff like that by lots of people who instead
of actually replying to my posts they deviate and have endless
conversation about me.


What did you expect? That you could just keep asking to be helped
in obnoxious ways without people commenting on that?


Enough is enough. Iam not a troll, neither incompetent. Period.


No not period. You have by your behaviour made yourself a reputation
of being an incompetent inconsiderate jerk. You don't lose such a 
repuation by simply claiming you are not.


--
Antoon Pardon



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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon

Op 30-06-13 23:57, Joshua Landau schreef:

On 30 June 2013 20:58, Robert Kernrobert.k...@gmail.com  wrote:

On 2013-06-30 18:24, Νίκος wrote:


Στις 29/6/2013 8:00 μμ, ο/η Mark Lawrence έγραψε:


Why this when the approach to Nick the Incompetant Greek has been to
roll out the red carpet?



Your mother is incompetent who raised a brat like you.



That is not acceptable behavior on this list. Please keep the gratuitous
insults offlist.


As much as you are right, this argument was started by Mark. If you
reprimand anyone (other threads being ignored) it should be him.
Reacting only to Nick, even though what Nick said was undue, implies
that you agree with Mark's actions.


I don't agree Mark started this argument. That he gave a negative
appraisal of Nikos is not starting an argument in itself.


Remember that Nick is as much a human as all of us, he is bound to
have his feelings hurt when so many people pick on him -- whether they
are justified or not.


So? Should we particularly care about Nikos's feelings? Nikos is not
the victim, he is the instigator. And should his feelings get hurt
when it is pointed out what picture people got from him through his
own behaviour, I say good. May that way he'll learn that if he doesn't
want to be considered an incompetent inconsiderate jerk, he shouldn't
behave like one.

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


Re: Don't feed the troll...

2013-07-01 Thread Antoon Pardon

Op 30-06-13 19:50, Ian Kelly schreef:

On Sun, Jun 30, 2013 at 11:25 AM, Antoon Pardon




That is a bit odd. Rurpy seemed to consider it a big nono if others
used methods that would coerce him to change his behaviour. But here
you see shaming as an option which seems a coercive method.


Well, if it didn't work the first time, I wouldn't keep at it.  I
don't consider that coercive.


That is a fair point.

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


Re: indexerror: list index out of range??

2013-07-01 Thread Joshua Landau
On 29 June 2013 15:30, Mark Lawrence breamore...@yahoo.co.uk wrote:

 On 29/06/2013 14:44, Dave Angel wrote:

 Since you're using the arrogant and buggy GoogleGroups, this
 http://wiki.python.org/moin/GoogleGroupsPython.

 Please don't make comments like this, you'll upset the Python Mailing List
 Police.

*doesn't understand*
-- 
http://mail.python.org/mailman/listinfo/python-list


password protect file

2013-07-01 Thread gmsiders
I was wondering if there was a couple of words or things i could add to the top 
of my python script to password protect it so that it asks user for the 
password and then after three tries it locks them out or says access denied 
and closes/ends the script but if they get it wright it proceeds on to the next 
line of the script total noob here any help appreciated
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Closures in leu of pointers?

2013-07-01 Thread Steven D'Aprano
On Sat, 29 Jun 2013 23:46:12 -0600, Ian Kelly wrote:

 On a related note, I think that generator functions should in some way
 be explicitly marked as such in the declaration, rather than needing to
 scan the entire function body for a yield statement to determine whether
 it's a generator or not.

That was considered when generators were introduced in Python 2.2. 
Guido's rationale for preferring to keep def for both generator 
functions and normal functions is given in the PEP:


Issue:  Introduce another new keyword (say, gen or generator) in
place of def, or otherwise alter the syntax, to distinguish
generator-functions from non-generator functions.

Con:  In practice (how you think about them), generators *are*
functions, but with the twist that they're resumable.  The mechanics
of how they're set up is a comparatively minor technical issue, and
introducing a new keyword would unhelpfully overemphasize the
mechanics of how generators get started (a vital but tiny part of a
generator's life).

Pro:  In reality (how you think about them), generator-functions are
actually factory functions that produce generator-iterators as if by
magic.  In this respect they're radically different from non-generator
functions, acting more like a constructor than a function, so reusing
def is at best confusing.  A yield statement buried in the body is
not enough warning that the semantics are so different.

BDFL:  def it stays.  No argument on either side is totally
convincing, so I have consulted my language designer's intuition.  It
tells me that the syntax proposed in the PEP is exactly right - not
too hot, not too cold.  But, like the Oracle at Delphi in Greek
mythology, it doesn't tell me why, so I don't have a rebuttal for the
arguments against the PEP syntax.  The best I can come up with (apart
from agreeing with the rebuttals ... already made) is FUD.  If this
had been part of the language from day one, I very much doubt it
would have made Andrew Kuchling's Python Warts page.


http://www.python.org/dev/peps/pep-0255/


5+ versions later, I think that Guido has been shown to be correct. Even 
if you believe that generator functions would have been better with 
different syntax, there is no evidence that re-using def is actively 
harmful.



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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 9:23 πμ, ο/η Antoon Pardon έγραψε:

Enough is enough. Iam not a troll, neither incompetent. Period.


No not period. You have by your behaviour made yourself a reputation
of being an incompetent inconsiderate jerk. You don't lose such a
repuation by simply claiming you are not.


Being a newbie doesn't mean that i'm incompetent jerk.

All i did was asking for help for issues i couldn't solve.
That what everybody would do if he couldn't help himself solve something.

You on the other hand never care to reply to any of my questions(so it 
was in someway justified for you to say i didn't follow your advice), 
but instead you seem to be willing to judge endlessly for the help i 
receive from others.


You are continuously spamming the list and my threads with arguments of 
trolling or not trolling instead of being helpful.


I as well as others are fed up seeing you post about me. Its over 2 
weeks now and you still fight of whether i'm trolling or not.


So shut your piehole and start proving yourself useful in this list.
Or sod off.
Preferably do the latter.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε:

Remember that Nick is as much a human as all of us, he is bound to
have his feelings hurt when so many people pick on him -- whether they
are justified or not.


So? Should we particularly care about Nikos's feelings? Nikos is not
the victim, he is the instigator. And should his feelings get hurt
when it is pointed out what picture people got from him through his
own behaviour, I say good. May that way he'll learn that if he doesn't
want to be considered an incompetent inconsiderate jerk, he shouldn't
behave like one.


Well, i will also follow your advice and not care at all about your 
feeling when you read the following.


GO FUCK YOURSELF.

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


Re: indexerror: list index out of range??

2013-07-01 Thread Robert Kern

On 2013-06-29 16:52, Joshua Landau wrote:

On 29 June 2013 15:30, Mark Lawrence breamore...@yahoo.co.uk wrote:


On 29/06/2013 14:44, Dave Angel wrote:


Since you're using the arrogant and buggy GoogleGroups, this
http://wiki.python.org/moin/GoogleGroupsPython.


Please don't make comments like this, you'll upset the Python Mailing List
Police.


*doesn't understand*


Mark frequently makes similar comments (in content and tone) to people who come 
here using Google Groups. Presumably, he has received criticism for this (mostly 
on tone grounds, I imagine), either on or off list.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 09:52, Νίκος schreef:
 Στις 1/7/2013 9:23 πμ, ο/η Antoon Pardon έγραψε:
 Enough is enough. Iam not a troll, neither incompetent. Period.

 No not period. You have by your behaviour made yourself a reputation
 of being an incompetent inconsiderate jerk. You don't lose such a
 repuation by simply claiming you are not.

 Being a newbie doesn't mean that i'm incompetent jerk.

That is true. You'll notice I don't judge all newbies as
incompetent jerks. Just you


 All i did was asking for help for issues i couldn't solve.
 That what everybody would do if he couldn't help himself solve something.

You can try to frame what you did as an innocent newbie asking
questions but that is not what happened. What happened is
that you started a project on which other people relied that was
way over your head. That makes you more than just a newbie
that makes you incompetent. When you then started to get into
trouble you didn't just ask questions, you almost demanded that
people would fix your problems for you, bumping a thread
within a few hours if you didn't get an answer within that time.
That and similar behaviour makes you a jerk.


 You on the other hand never care to reply to any of my questions(so it
 was in someway justified for you to say i didn't follow your advice),
 but instead you seem to be willing to judge endlessly for the help i
 receive from others.

I am not judging you for the you receive. I am judging you for
behaving liken an asshole and trying to deny it.


 You are continuously spamming the list and my threads with arguments
 of trolling or not trolling instead of being helpful.

 I as well as others are fed up seeing you post about me. Its over 2
 weeks now and you still fight of whether i'm trolling or not.

And it probably becomes
 longer. If you don't want this to fester,
you'd better stop denying that you were behaving like an
incompetent inconsiderate jerk. People can forget and forgive
jerky behaviour but they don't tend to when they see the
other denying he was behaving like a jerk. Because they then
expect more of that kind of behaviour.

 So shut your piehole and start proving yourself useful in this list.
 Or sod off.
 Preferably do the latter.

Oh we do have illusions of grandeur, don't we? You are in no position
to judge who is useful on this list or not.

-- 
Antoon Pardon

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 09:55, Νίκος schreef:
 Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε:
 Remember that Nick is as much a human as all of us, he is bound to
 have his feelings hurt when so many people pick on him -- whether they
 are justified or not.

 So? Should we particularly care about Nikos's feelings? Nikos is not
 the victim, he is the instigator. And should his feelings get hurt
 when it is pointed out what picture people got from him through his
 own behaviour, I say good. May that way he'll learn that if he doesn't
 want to be considered an incompetent inconsiderate jerk, he shouldn't
 behave like one.

 Well, i will also follow your advice and not care at all about your
 feeling when you read the following.

This makes no sense. You are not following my advice, if you were
already behaving like this.


 GO FUCK YOURSELF.


No thanks, I'm getting a little old for that.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε:

So shut your piehole and start proving yourself useful in this list.
Or sod off.
Preferably do the latter.

Oh we do have illusions of grandeur, don't we? You are in no position
to judge who is useful on this list or not.


I'am not waste any more time explaining my self to you since you have 
already made up your mind and you refuse to believe that ni was actually 
trying to solve my problems first and then asked and then tried to apply 
the solutions, which in my my 2 last problems i was the one who actually 
solve the problem.


Its easier to say to you fuck off retard.
--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list


Need explanation of this error

2013-07-01 Thread prerit86
Hi,

I'm new to Python and trying to run a already written code. Can someone please 
explain the error below? And if possible, how do I resolve this?

Traceback (most recent call last):
  File c:\Project_1\regression_1.py, line 7, in module
from sklearn import metrics, cross_validation, linear_model
  File c:\Python27\lib\site-packages\sklearn\metrics\__init__.py, line 31, in
module
from . import cluster
  File c:\Python27\lib\site-packages\sklearn\metrics\cluster\__init__.py, line
 8, in module
from .supervised import adjusted_mutual_info_score
  File c:\Python27\lib\site-packages\sklearn\metrics\cluster\supervised.py, li
ne 19, in module
from .expected_mutual_info_fast import expected_mutual_information
  File expected_mutual_info_fast.pyx, line 10, in init sklearn.metrics.cluster
.expected_mutual_info_fast (sklearn\metrics\cluster\expected_mutual_info_fast.c:
4886)
  File c:\Python27\lib\site-packages\scipy\special\__init__.py, line 529, in 
module
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need explanation of this error

2013-07-01 Thread Robert Kern

On 2013-07-01 10:13, preri...@gmail.com wrote:

Hi,

I'm new to Python and trying to run a already written code. Can someone please 
explain the error below? And if possible, how do I resolve this?

Traceback (most recent call last):
   File c:\Project_1\regression_1.py, line 7, in module
 from sklearn import metrics, cross_validation, linear_model
   File c:\Python27\lib\site-packages\sklearn\metrics\__init__.py, line 31, in
module
 from . import cluster
   File c:\Python27\lib\site-packages\sklearn\metrics\cluster\__init__.py, 
line
  8, in module
 from .supervised import adjusted_mutual_info_score
   File c:\Python27\lib\site-packages\sklearn\metrics\cluster\supervised.py, 
li
ne 19, in module
 from .expected_mutual_info_fast import expected_mutual_information
   File expected_mutual_info_fast.pyx, line 10, in init 
sklearn.metrics.cluster
.expected_mutual_info_fast (sklearn\metrics\cluster\expected_mutual_info_fast.c:
4886)
   File c:\Python27\lib\site-packages\scipy\special\__init__.py, line 529, in 

module
 from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.


This particular module incorporates FORTRAN subroutines. My guess is that 
whoever compiled your scipy binary did it in such a way that the FORTRAN 
standard library was being linked in as a DLL instead of statically. This DLL is 
not present on your system. Windows is trying to find it, but failing.


How did you install scipy? If you used a prebuilt binary installer, can you 
please link to the exact one that you used?


Try using depends.exe to find out what DLL it is looking for.

  http://www.dependencywalker.com/

The file that you want to check in depends.exe:

  c:\Python27\lib\site-packages\scipy\special\_ufuncs.pyd

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: settrace doesn't trace builtin functions

2013-07-01 Thread Skip Montanaro
   I've been using the settrace function to write a tracer for my program, 
 which is working great except that it doesn't seem to work for built-in 
 functions, like open('filename.txt').  This doesn't seem to be documented, so 
 I'm not sure if I'm doing something wrong or that's the expected behavior.

I believe that's expected behavior.  Stuff written in Python is
traced.  C functions are not.  It's been a whole lot of years since I
looked at that code though, so I might be misremembering.

 The other option I considered was monkey-patching the open function through a 
 wrapper ... but that seemed very brittle to me.

For debugging purposes, practicality beats purity.  I trust you won't
be tracing in a production environment, so fragility shouldn't be a
major concern.  Monkey patching seems entirely appropriate to me.

Python 2.x:

 open
built-in function open
 import __builtin__
 open is __builtin__.open
True
 _open = __builtin__.open
 def open(name, mode=None, buffering=None):
...   return _open(name, mode, buffering)
...
 __builtin__.open = open
 open is __builtin__.open
True
 open
function open at 0x82afa3c

Python 3.x:

 import builtins
 open
built-in function open
 open is builtins.open
True
 _open = builtins.open
 def open(file, mode='r', buffering=-1, encoding=None,
...  errors=None, newline=None, closefd=True, opener=None):
...   return _open(file, mode, buffering, encoding, errors, newline,
closefd, opener)
...
 _open
built-in function open
 builtins.open = open
 open
function open at 0x1010c18c8

You can, of course, do this for more builtins.  Presuming you can get
a handle on a function's namespace and modify it, you should be able
to perform the same trick for most functions or methods written in C.

 sys._settrace = sys.settrace
 def settrace(*args, **kwds):
...   return sys._settrace(*args, **kwds)
...
 sys.settrace = sys._settrace

Totally untested.  No warranties expressed or implied. YMMV...  etc, etc

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 11:05, Νίκος schreef:
 Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε:
 So shut your piehole and start proving yourself useful in this list.
 Or sod off.
 Preferably do the latter.
 Oh we do have illusions of grandeur, don't we? You are in no position
 to judge who is useful on this list or not.

 I'am not waste any more time explaining my self to you since you have
 already made up your mind and you refuse to believe that ni was
 actually trying to solve my problems first and then asked and then
 tried to apply the solutions, which in my my 2 last problems i was the
 one who actually solve the problem.

The above is a first class illustration of why I think you are
problematic. We don't want you to explain yourself, we want
you to change your behaviour. Someone behaving like a jerk
explaining himself is still behaving like a jerk and the
explanation is just a method for avoiding changing the
behaviour.

It doesn't matter that you tried to solve your problem first.
Accepting that you were, you were still acting like a jerk
when you bumped the thread after only a few hours.

 Its easier to say to you fuck off retard.

Indeed that is much easier than trying to change your behaviour
in order to no longer behave like a jerk.

-- 
Antoon Pardon

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Steve Simmons
Νίκος ni...@superhost.gr wrote:

Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε:
 So shut your piehole and start proving yourself useful in this list.
 Or sod off.
 Preferably do the latter.
 Oh we do have illusions of grandeur, don't we? You are in no position
 to judge who is useful on this list or not.

I'am not waste any more time explaining my self to you since you have 
already made up your mind and you refuse to believe that ni was
actually 
trying to solve my problems first and then asked and then tried to
apply 
the solutions, which in my my 2 last problems i was the one who
actually 
solve the problem.

Its easier to say to you fuck off retard.
-- 
What is now proved was at first only imagined!
-- 
http://mail.python.org/mailman/listinfo/python-list

I don't know about the other members of this list but I am becoming 
increasingly disturbed by the rudeness and especially the foul language that is 
being perpetrated on this thread.  Please, if you have any decency at all, 
continue the rest of this exchange by private email and allow python list 
members to continue discussing and helping each other with the python language 
and is adjuncts. Leave us in peace to enjoy our favoured language and let us 
see no more of your filth. 

Sent from a Galaxy far far away-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 12:32 μμ, ο/η Antoon Pardon έγραψε:

Op 01-07-13 11:05, Νίκος schreef:

Στις 1/7/2013 11:54 πμ, ο/η Antoon Pardon έγραψε:

So shut your piehole and start proving yourself useful in this list.
Or sod off.
Preferably do the latter.

Oh we do have illusions of grandeur, don't we? You are in no position
to judge who is useful on this list or not.


I'am not waste any more time explaining my self to you since you have
already made up your mind and you refuse to believe that ni was
actually trying to solve my problems first and then asked and then
tried to apply the solutions, which in my my 2 last problems i was the
one who actually solve the problem.


The above is a first class illustration of why I think you are
problematic. We don't want you to explain yourself, we want
you to change your behaviour. Someone behaving like a jerk
explaining himself is still behaving like a jerk and the
explanation is just a method for avoiding changing the
behaviour.


Change what dickhead? What behavior?
The behavior which you think its problematic?
Maybe you should change your perception of understanding things.

I dont expect anyone to solve my problems, iam happy if they point me to 
a direction which i can solve it myself, that what the list is about.




It doesn't matter that you tried to solve your problem first.
Accepting that you were, you were still acting like a jerk
when you bumped the thread after only a few hours.


Its easier to say to you fuck off retard.


Indeed that is much easier than trying to change your behaviour
in order to no longer behave like a jerk.


Did i told you to fuck off? Well never mind. Fuck off!


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


Re: Need explanation of this error

2013-07-01 Thread Denis McMahon
On Mon, 01 Jul 2013 02:13:50 -0700, prerit86 wrote:

 I'm new to Python and trying to run a already written code. Can someone
 please explain the error below? And if possible, how do I resolve this?

 ImportError: DLL load failed: The specified module could not be found.

You're missing the dll that provides some function that you're trying to 
use.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 12:31 μμ, ο/η Steve Simmons έγραψε:


I don't know about the other members of this list but I am becoming
increasingly disturbed by the rudeness and especially the foul language
that is being perpetrated on this thread. Please, if you have any
decency at all, continue the rest of this exchange by private email and
allow python list members to continue discussing and helping each other
with the python language and is adjuncts. Leave us in peace to enjoy our
favoured language and let us see no more of your filth.

Sent from a Galaxy far far away


I have kept in quite more than 2 weeks while kept reading any mail in 
this list especially the endless conversation and numerous name callings 
against me.


You should know that i'm fed up reading this.
If i'm provoked i will respond.
it is not in my intentons to troll the list or talk dirty, but also i 
cannot withstand anymore people talk down to me like that, when the only 
thing i doid was to ask some questions, which in turn helped us all.


Especially i cant stand people which never to spend 5 mins to reply, but 
they are devoted a couple of weeks to belittle me instead.


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


Re: Need explanation of this error

2013-07-01 Thread prerit86
Thanks!

Solved. I found the package that would resolve this dependency. It was 
numpy-MKL.

Downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pandas

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


File exists but Python says 'not found'.

2013-07-01 Thread prerit86
I'm running this code that reads 2 csv files (one of them is train.csv). The 
code gives an error saying 'file not does not exist'. However, the file does 
exists in the same location as the .py file. Can someone please help me on 
this. Thanks!

Code Output--

Reading dataset...
Traceback (most recent call last):
  File c:\Project_1\regression_2.py, line 163, in module
main(**args)
  File c:\Project_1\regression_2.py, line 80, in main
train_data = pd.read_csv(train)
  File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 401, in parser
_f
return _read(filepath_or_buffer, kwds)
  File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 209, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
  File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 509, in __init
__
self._make_engine(self.engine)
  File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 611, in _make_
engine
self._engine = CParserWrapper(self.f, **self.options)
  File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 893, in __init
__
self._reader = _parser.TextReader(src, **kwds)
  File parser.pyx, line 312, in pandas._parser.TextReader.__cinit__ (pandas\sr
c\parser.c:2846)
  File parser.pyx, line 512, in pandas._parser.TextReader._setup_parser_source
 (pandas\src\parser.c:4893)
IOError: File train.csv does not exist
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File exists but Python says 'not found'.

2013-07-01 Thread Robert Kern

On 2013-07-01 11:47, preri...@gmail.com wrote:

I'm running this code that reads 2 csv files (one of them is train.csv). The 
code gives an error saying 'file not does not exist'. However, the file does 
exists in the same location as the .py file. Can someone please help me on 
this. Thanks!


How are you running the code? If you are doing pandas.read_csv('train.csv'), the 
file must be in the current working directory of the running process. The 
location of the .py file contain the code is not relevant. For example, if you 
are using an IDE to run the script, you may need to configure how it runs the 
script to pick a particular directory for it to run in.



Code Output--

Reading dataset...
Traceback (most recent call last):
   File c:\Project_1\regression_2.py, line 163, in module
 main(**args)
   File c:\Project_1\regression_2.py, line 80, in main
 train_data = pd.read_csv(train)


Since the filename of regression_2.py in the traceback is fully-qualified, I 
expect that you are running the program from something other than the 
c:\Project_1\ directory.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: File exists but Python says 'not found'.

2013-07-01 Thread Antoon Pardon
Op 01-07-13 12:47, preri...@gmail.com schreef:
 I'm running this code that reads 2 csv files (one of them is train.csv). The 
 code gives an error saying 'file not does not exist'. However, the file does 
 exists in the same location as the .py file. Can someone please help me on 
 this. Thanks!

 Code Output--

 Reading dataset...
 Traceback (most recent call last):
   File c:\Project_1\regression_2.py, line 163, in module
 main(**args)
   File c:\Project_1\regression_2.py, line 80, in main
 train_data = pd.read_csv(train)
   File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 401, in 
 parser
 _f
 return _read(filepath_or_buffer, kwds)
   File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 209, in 
 _read
 parser = TextFileReader(filepath_or_buffer, **kwds)
   File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 509, in 
 __init
 __
 self._make_engine(self.engine)
   File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 611, in 
 _make_
 engine
 self._engine = CParserWrapper(self.f, **self.options)
   File c:\Python27\lib\site-packages\pandas\io\parsers.py, line 893, in 
 __init
 __
 self._reader = _parser.TextReader(src, **kwds)
   File parser.pyx, line 312, in pandas._parser.TextReader.__cinit__ 
 (pandas\sr
 c\parser.c:2846)
   File parser.pyx, line 512, in 
 pandas._parser.TextReader._setup_parser_source
  (pandas\src\parser.c:4893)
 IOError: File train.csv does not exist

My guess is that train.csv is a symbolic link that points to a file
that doesn't exist. So looking at your directory you can see an entry
but actualy trying to open it will fail.

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


Re: File exists but Python says 'not found'.

2013-07-01 Thread prerit86
The variable 'train' is being called like this -

def main(train='train.csv', test='test.csv', submit='logistic_pred.csv'):
print Reading dataset...
train_data = pd.read_csv(train)
test_data = pd.read_csv(test)

Let me know if I need to post the full code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File exists but Python says 'not found'.

2013-07-01 Thread prerit86
I got it. The working directory was different. Sorry, I'm new and didn't the 
working directory has to be the location of the data. I thought the location of 
.py file and data file should be same. Thanks! Es. Robert Kern.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File exists but Python says 'not found'.

2013-07-01 Thread Antoon Pardon
Op 01-07-13 12:57, preri...@gmail.com schreef:
 The variable 'train' is being called like this -

 def main(train='train.csv', test='test.csv', submit='logistic_pred.csv'):
 print Reading dataset...
 train_data = pd.read_csv(train)
 test_data = pd.read_csv(test)

 Let me know if I need to post the full code.

I think Robert wanted to know how you started the program.
What instruction do you use to launch?
In what directory are you launching your program?
Is that the same directory where train.csv is present?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File exists but Python says 'not found'.

2013-07-01 Thread prerit86
My answers

I think Robert wanted to know how you started the program. 
What instruction do you use to launch? 
- used command c:\python27\python.exe c:\project_1\code.py

In what directory are you launching your program?
- working directory was c:
- python is in c:\python27
- code was in c:\project_1
- changed the working directory to c:\project_1 now and it worked

Is that the same directory where train.csv is present? 
- train.csv is present in c:\project_1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: File exists but Python says 'not found'.

2013-07-01 Thread Dave Angel

On 07/01/2013 07:00 AM, preri...@gmail.com wrote:

I got it. The working directory was different. Sorry, I'm new and didn't the 
working directory has to be the location of the data. I thought the location of 
.py file and data file should be same. Thanks! Es. Robert Kern.



Python didn't make that assumption, the author of the script did.  By 
using a relative name like train.csv, he is implicitly forcing Python to 
use the current working directory.


If he had wanted the file to be found in the same directory as one of 
the source files, he could have built an absolute path by using the 
__file__ attribute of the module.


However, for non-const files, the source directory is generally a bad 
place to put them.


Confounding things is the strange habit that Windows has of deciding 
that the script location *should* be your current directory.  I believe 
Explorer does that if you right-click select a script.



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


Re: File exists but Python says 'not found'.

2013-07-01 Thread prerit86
I know. Had I written the code, I would have not done this. I just wanted to 
get some initial results by leveraging this code. I would now build on this to 
improve my work's accuracy.

Thanks for the inputs!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 11:37, Νίκος schreef:
 Στις 1/7/2013 12:32 μμ, ο/η Antoon Pardon έγραψε:

 The above is a first class illustration of why I think you are
 problematic. We don't want you to explain yourself, we want
 you to change your behaviour. Someone behaving like a jerk
 explaining himself is still behaving like a jerk and the
 explanation is just a method for avoiding changing the
 behaviour.

 Change what dickhead? What behavior?
 The behavior which you think its problematic?

You are goin to play the ignorance card now? You are
going to pretend it is just me and ignore all those
others who made remarks about particular behaviour
of you being annoying and unacceptable. I gave
a specific answer, you bumping threads are only a few
hours. You could have acknowledge that indeed you
have been doing that and that you understand that
it is annoying to others and you could have made it
clear you intended to be more patient in the future.
That could have been the beginning of you gaining
again some good will from members of the group.

Instead you chose to be a jerk about it. Pretending
that the multiple remarks you have received about
this behaviour didn't happen.

 Maybe you should change your perception of understanding things.

Why should I. From the people with whom I discussed your
behaviour, a lot disputed you were a troll, but none disputed
you were behaving like an asshole. Yes even those who were
willing to further help you agreed that your behaviour was
problematic.


 I dont expect anyone to solve my problems, iam happy if they point me
 to a direction which i can solve it myself, that what the list is about.

Sure, you just play the impatient jerk, who bumps threads and
asks the same question again after people have pointed you
in a direction.


 Did i told you to fuck off? Well never mind. Fuck off!


I think this needs some work. You need more creativity.
Try to think of something more forceful. My little niece
of 10 can do better than that.

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


Re: indexerror: list index out of range??

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 09:45:52 +0100, Robert Kern wrote:

 On 2013-06-29 16:52, Joshua Landau wrote:
 On 29 June 2013 15:30, Mark Lawrence breamore...@yahoo.co.uk wrote:

 On 29/06/2013 14:44, Dave Angel wrote:

 Since you're using the arrogant and buggy GoogleGroups, this
 http://wiki.python.org/moin/GoogleGroupsPython.

 Please don't make comments like this, you'll upset the Python Mailing
 List Police.

 *doesn't understand*
 
 Mark frequently makes similar comments (in content and tone) to people
 who come here using Google Groups. Presumably, he has received criticism
 for this (mostly on tone grounds, I imagine), either on or off list.

That would be me, and it wasn't about Google Groups.

After Mark was repeatedly abusive towards somebody, including telling 
this person to kill themselves, and after he chose to ignore both polite 
requests to cease flaming, and a fair warning that he would be kill-filed 
if he persisted, he persisted and so I kill-filed him. Which is a pity, 
because Mark does know Python well and he can be very helpful (although 
sometimes abrasive). I think on balance, when he's not flaming, he makes 
a positive contribution to this community.

The kill-filing is only temporary, and I look forward to seeing his posts 
again soon. Hopefully by that time, he'll stop feeling put-out and hurt 
that I've chosen to not read his flames, and cease misrepresenting my 
actions.


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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 11:46, Νίκος schreef:
 Στις 1/7/2013 12:31 μμ, ο/η Steve Simmons έγραψε:

 I don't know about the other members of this list but I am becoming
 increasingly disturbed by the rudeness and especially the foul language
 that is being perpetrated on this thread. Please, if you have any
 decency at all, continue the rest of this exchange by private email and
 allow python list members to continue discussing and helping each other
 with the python language and is adjuncts. Leave us in peace to enjoy our
 favoured language and let us see no more of your filth.

 Sent from a Galaxy far far away

 I have kept in quite more than 2 weeks while kept reading any mail in
 this list especially the endless conversation and numerous name
 callings against me.


You poor thing. A horrible two weeks of people who couldn't see
the pearls of consideration you had shown and who were
seeing you as somekind of asshole.

 You should know that i'm fed up reading this.
 If i'm provoked i will respond.

Yes, because if you are fed up with how others behave,  it is the fault
of these
others in provoking you. And of course when the others are fed of with how
you behave, it is again the fault of the others because the have a
faulty perception
of understanding things.

 it is not in my intentons to troll the list or talk dirty, but also i
 cannot withstand anymore people talk down to me like that, when the
 only thing i doid was to ask some questions, which in turn helped us all.

Indeed it is not your intention to troll, you only want to ask questions.
And if it turns out that your behaviour during the asking of these questions
is very annoying, we should just shoulder the burden of that annoyance
since it wasn't intended. Asking you to change your behaviour? That
wouldn't be fair because you never intended to annoy.

 Especially i cant stand people which never to spend 5 mins to reply,
 but they are devoted a couple of weeks to belittle me instead.

I can't stand people who seem to think that only people who have helped
them can give valid criticism. Yet here you are. It seems we'll both have
to find a way in coping.

-- 
Antoon Pardon

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 10:52:28 +0300, Νίκος wrote:

 All i did was asking for help for issues i couldn't solve. That what
 everybody would do if he couldn't help himself solve something.
[...]
 So shut your piehole and start proving yourself useful in this list. Or
 sod off.
 Preferably do the latter.


Enough Νίκος. If you can't be the bigger man and ignore other people's 
insults, take your flaming off-list. I don't care if you get into the 
mother of all flame-fests, so long as it is OFF LIST and doesn't upset 
this forum. If you continue to be abusive on this list, I will kill-file 
you and will not even see your posts, and no doubt others will do the 
same.

It doesn't matter who started it. It doesn't matter if you're just trying 
to get some help. If you continue being abusive, you will lose the few 
allies you have left.

The same goes to the Net Vigilantes trying to drive Νίκος away. I can't 
speak for others, but I can speak for myself, and abuse and flaming has 
no place in this forum, and if you continue to behave abusively, I will 
kill-file you too.

Νίκος, I am not going to wade through this long, long thread to see what 
problem you are trying to solve today. I only have a limited number of 
hours available, and it is unfair for you to monopolise all my time. 
Also, sometimes I simply do not know how to solve your technical 
problems. I don't know everything. But I will give you a commitment: if 
you follow the advice here: 

http://sscce.org/

and come up with a short, self-contained, runnable example of the problem 
you are having in this thread, I commit to reading your post and making 
an honest effort to solve the problem by Wednesday evening (Melbourne, 
Australia time). The above website is written for Java programmers, but 
the advice holds for any language including Python.

The above of course assumes that I have not kill-filed you for continuing 
to be abusive on-list.


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


Re: Stupid ways to spell simple code

2013-07-01 Thread Neil Cerutti
On 2013-06-30, Chris Angelico ros...@gmail.com wrote:
 So, here's a challenge: Come up with something really simple,
 and write an insanely complicated - yet perfectly valid - way
 to achieve the same thing. Bonus points for horribly abusing
 Python's clean syntax in the process.

 Go on, do your worst!

I've often thought it was redundant for Python to support 'if'
when it has dictionaries, cf the rationale for having no
'switch'.

valid_name = None
while not valid_name:
name = input(Enter your name: )
valid_name = {
True: lambda: print(No name longer than 20 letters.),
False: lambda: True,
}[len(name)  20]()

Much better.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon
Op 01-07-13 14:43, Steven D'Aprano schreef:

 Νίκος, I am not going to wade through this long, long thread to see what 
 problem you are trying to solve today.

Nikos is not trying to solve a problem in this thread. What happened is that
the original poster here got a rather short answer to his question. Mark
Laurence reacted questioning why this person didn't get the same kind
of treatment as Nick the Incompetant Greek. Then Nikos came in with
an insulting remark. The rest developed from their.

So nobody was trying to drive Nikos away (for asking questions).

-- 
Antoon Pardon.

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


Re: Stupid ways to spell simple code

2013-07-01 Thread Chris Angelico
On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti ne...@norwich.edu wrote:
 On 2013-06-30, Chris Angelico ros...@gmail.com wrote:
 So, here's a challenge: Come up with something really simple,
 and write an insanely complicated - yet perfectly valid - way
 to achieve the same thing. Bonus points for horribly abusing
 Python's clean syntax in the process.

 Go on, do your worst!

 I've often thought it was redundant for Python to support 'if'
 when it has dictionaries, cf the rationale for having no
 'switch'.

 valid_name = None
 while not valid_name:
 name = input(Enter your name: )
 valid_name = {
 True: lambda: print(No name longer than 20 letters.),
 False: lambda: True,
 }[len(name)  20]()

 Much better.

Good! Good! But, wh. Wh.

def get_name():
  while True:
name = input(Enter your name: )
yield {
True: lambda: print(No name longer than 20 letters.),
False: lambda: name,
}[len(name)  20]()
name = next(filter(None,get_name()))

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 3:28 μμ, ο/η Antoon Pardon έγραψε:

Did i told you to fuck off? Well never mind. Fuck off!

I think this needs some work. You need more creativity.
Try to think of something more forceful. My little niece
of 10 can do better than that.


Well i could, but i don't want to spend my time and creativitism on 
assholes like yourself.


So, here it is again, plain and simple. FUCK OFF!

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 3:43 μμ, ο/η Steven D'Aprano έγραψε:

On Mon, 01 Jul 2013 10:52:28 +0300, Νίκος wrote:


All i did was asking for help for issues i couldn't solve. That what
everybody would do if he couldn't help himself solve something.

[...]

So shut your piehole and start proving yourself useful in this list. Or
sod off.
Preferably do the latter.



Enough Νίκος. If you can't be the bigger man and ignore other people's
insults, take your flaming off-list. I don't care if you get into the
mother of all flame-fests, so long as it is OFF LIST and doesn't upset
this forum. If you continue to be abusive on this list, I will kill-file
you and will not even see your posts, and no doubt others will do the
same.

It doesn't matter who started it. It doesn't matter if you're just trying
to get some help. If you continue being abusive, you will lose the few
allies you have left.

The same goes to the Net Vigilantes trying to drive Νίκος away. I can't
speak for others, but I can speak for myself, and abuse and flaming has
no place in this forum, and if you continue to behave abusively, I will
kill-file you too.

Νίκος, I am not going to wade through this long, long thread to see what
problem you are trying to solve today. I only have a limited number of
hours available, and it is unfair for you to monopolise all my time.
Also, sometimes I simply do not know how to solve your technical
problems. I don't know everything. But I will give you a commitment: if
you follow the advice here:

http://sscce.org/

and come up with a short, self-contained, runnable example of the problem
you are having in this thread, I commit to reading your post and making
an honest effort to solve the problem by Wednesday evening (Melbourne,
Australia time). The above website is written for Java programmers, but
the advice holds for any language including Python.

The above of course assumes that I have not kill-filed you for continuing
to be abusive on-list.


So, Steven you want me to sit tight and read all the insults coming from 
this guy?


If that happened to you, wouldn't you feel the need and urge to reply 
back and stand for yourself?


Almost 2 weeks now that i solved my last website problems this person 
amongst others that especially him is keeping this list busy talking 
down to me.


What am i supposed to do? Listening him for ever?
I use Thunderbird and i'm currently looking for a way to kill-file him, 
because he is not likely to stop.


And no, i do not want to piss off people like you, who have spend time 
helping me.


But i cannot stand him either.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Andrew Berg
On 2013.07.01 08:28, Νίκος wrote:
 So, Steven you want me to sit tight and read all the insults coming from 
 this guy?
 
 If that happened to you, wouldn't you feel the need and urge to reply 
 back and stand for yourself?
You can ignore it (this is the best solution) or you can take it off-list.
Most on this list do not consider insults and flaming on the list acceptable.
It doesn't matter who started it.

 I use Thunderbird and i'm currently looking for a way to kill-file him, 
 because he is not likely to stop.
Tools - Message Filters...

-- 
CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Walter Hurry
On Mon, 01 Jul 2013 10:56:54 +0200, Antoon Pardon wrote:

 Op 01-07-13 09:55, Νίκος schreef:
 Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε:
 Remember that Nick is as much a human as all of us, he is bound to
 have his feelings hurt when so many people pick on him -- whether
 they are justified or not.

 So? Should we particularly care about Nikos's feelings? Nikos is not
 the victim, he is the instigator. And should his feelings get hurt
 when it is pointed out what picture people got from him through his
 own behaviour, I say good. May that way he'll learn that if he doesn't
 want to be considered an incompetent inconsiderate jerk, he shouldn't
 behave like one.

 Well, i will also follow your advice and not care at all about your
 feeling when you read the following.
 
 This makes no sense. You are not following my advice, if you were
 already behaving like this.
 
 
 GO FUCK YOURSELF.


 No thanks, I'm getting a little old for that.

Please...enough. Polite request: consider killfiling him and having done 
with it.

It is irritating to see all the responses even though I killfiled him 
long ago. Whilst I realise, of course, that it is entirely your 
prerogative to choose what to do, I have no doubt that many others feel 
as I do.

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


Re: Don't feed the troll...

2013-07-01 Thread rurpy
On 06/30/2013 11:25 AM, Antoon Pardon wrote:
 Op 28-06-13 19:20, Ian Kelly schreef:
[...]
 Flaming a troll is not punishing to them.
 
 I see I didn't make my point clear. This was my response to
 your remark about the collective experience going back decades.
 The collective experience often enough doesn't carry over wisdom
 but myth. To illustrate that, I gave the example of teachers whose
 collective experience is contradicted by the research. So if the
 only thing you can rely on is the collective experience of the
 group your knowledge isn't very relyable.

I don't have anything to add to the discussion beyond restating
what I've already said (which I'm not interested in doing), except 
to address this point in light of recent posts on the list.

You claim collective experience is not reliable and dismiss it 
in favor of your own theory, flaming trolls is a better response.
And your evidence for that?  Nothing (that I've read so far).

Collective experience may not always be totally reliable but it 
seems to me it is better than the non-experience that you have 
offered.

Ironically your flame war with Nikos in 
  http://mail.python.org/pipermail/python-list/2013-June/650905.html
provides evidence for the validity of the collective experience you 
dismiss, that engaging in flame wars with trolls simply produces more 
flames, hostility begets hostility.  I, and I think the majority of
people here, find that very unpleasant.  You have become (as predicted 
by the collective experience you dismiss) as offensive as any troll.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread rusi
On Monday, July 1, 2013 7:31:18 PM UTC+5:30, Walter Hurry wrote:
 Please...enough. Polite request: consider killfiling him and having done 
 with it.
 
 
 It is irritating to see all the responses even though I killfiled him 
 long ago. Whilst I realise, of course, that it is entirely your 
 prerogative to choose what to do, I have no doubt that many others feel 
 as I do.

Walter I would humbly suggest that you consider that the real problem here is 
the many others not speaking up.

And that is at least in part happening because of the wrong use of tools -- 
wrong uses that you are advocating above.

To wit:

1. Kill-filing/spam-filtering are tools for spam.
Nikos is certainly not spamming in the sense of automated sending out of cooked 
mail to zillions of recipients/lists.  His posts are definite and intentional

2. Likewise Nikos is not trolling.
A troll is someone who posts seemingly innocuous stuff to cause irritation and 
then enjoys the results.  Here he clearly wants answers to the questions he is 
asking

So I suggest that if we want to address this problem we need to sit back 
individually and collectively, put aside habitual labels like spam/troll, and 
likewise habits of mind, and ask what exactly is the problem we are dealing 
with.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Neil Cerutti
On 2013-07-01, rusi rustompm...@gmail.com wrote:
 To wit:

 1. Kill-filing/spam-filtering are tools for spam.
 Nikos is certainly not spamming in the sense of automated
 sending out of cooked mail to zillions of recipients/lists.
 His posts are definite and intentional

I disagree. Kill-files are not only for spam. I filter out
anything I believe I won't want to see.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 16:28:52 +0300, Νίκος wrote:

 Στις 1/7/2013 3:43 μμ, ο/η Steven D'Aprano έγραψε:
[...]
 The above of course assumes that I have not kill-filed you for
 continuing to be abusive on-list.
 
 So, Steven you want me to sit tight and read all the insults coming from
 this guy?
 
 If that happened to you, wouldn't you feel the need and urge to reply
 back and stand for yourself?

Stand up for yourself and be abusive are two different things. I told 
you, I don't care what you do off-list, but if you continue flaming on-
list, I will kill-file you.


 And no, i do not want to piss off people like you, who have spend time
 helping me.

Too late. I asked you to stop flaming on-list, and you didn't. I am now 
kill-filing you for a month. Feel grateful that it is not permanent, and 
take this time to reflect that you are running out of people willing to 
help you.


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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 15:08:18 +0200, Antoon Pardon wrote:

 Op 01-07-13 14:43, Steven D'Aprano schreef:
 
 Νίκος, I am not going to wade through this long, long thread to see
 what problem you are trying to solve today.
 
 Nikos is not trying to solve a problem in this thread. What happened is
 that the original poster here got a rather short answer to his question.
 Mark Laurence reacted questioning why this person didn't get the same
 kind of treatment as Nick the Incompetant Greek. Then Nikos came in
 with an insulting remark. The rest developed from their.

Okay, thank you for explaining the situation.

Now, please stop baiting Nikos.



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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread rusi
On Monday, July 1, 2013 9:04:11 PM UTC+5:30, Steven D'Aprano wrote:
  And no, i do not want to piss off people like you, who have spend time
  helping me.
 Too late. I asked you to stop flaming on-list, and you didn't. I am now 
 kill-filing you for a month. Feel grateful that it is not permanent, and 
 take this time to reflect that you are running out of people willing to 
 help you.
 -- 
 
 Steven


A suggestion (request??) to all list members in this respect:

We strengthen Steven's decision as follows:

For the next month (till 1st August)
- No discussions about Nikos specifically or trolling/flaming in general
- No answers to anything he asks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 6:34 μμ, ο/η Steven D'Aprano έγραψε:


And no, i do not want to piss off people like you, who have spend time
helping me.


Too late. I asked you to stop flaming on-list, and you didn't. I am now
kill-filing you for a month. Feel grateful that it is not permanent, and
take this time to reflect that you are running out of people willing to
help you.


First i saw his post and replied as i did and then i saw your reply.

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


Re: Stupid ways to spell simple code

2013-07-01 Thread Joshua Landau
On 1 July 2013 14:14, Chris Angelico ros...@gmail.com wrote:
 On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti ne...@norwich.edu wrote:
 On 2013-06-30, Chris Angelico ros...@gmail.com wrote:
 So, here's a challenge: Come up with something really simple,
 and write an insanely complicated - yet perfectly valid - way
 to achieve the same thing. Bonus points for horribly abusing
 Python's clean syntax in the process.

 Go on, do your worst!

 I've often thought it was redundant for Python to support 'if'
 when it has dictionaries, cf the rationale for having no
 'switch'.

 valid_name = None
 while not valid_name:
 name = input(Enter your name: )
 valid_name = {
 True: lambda: print(No name longer than 20 letters.),
 False: lambda: True,
 }[len(name)  20]()

 Much better.

 Good! Good! But, wh. Wh.

 def get_name():
   while True:
 name = input(Enter your name: )
 yield {
 True: lambda: print(No name longer than 20 letters.),
 False: lambda: name,
 }[len(name)  20]()
 name = next(filter(None,get_name()))

Oh, cruel. But you can do worse. Who needs while when you have
filter(iter(FUNCTION, object()))?

def get_name():
name = input(Enter your name: )
return [
lambda: name,
lambda: print(No name longer than 20 letters.),
][len(name)  20]()

name = next(filter(None, iter(get_name, object(


But who needs *any* of this! Defining functions is so old-hat. It's
all already in the standard library (using only assignments and function-calls):

from functools import partial
from operator import getitem, ge, methodcaller
from itertools import compress, tee
apply = methodcaller(__call__)
ret_true = partial(getitem, [True], 0)
print_invalid = partial(print, No name longer than 20 letters.)
inputs = iter(partial(input, Enter your name: ), ...)
inputs, valid = tee(inputs)
valid = map(len, valid)
valid = map(partial(ge, 20), valid)
side_effect_valid = map(partial(getitem, [print_invalid, ret_true]), valid)
side_effect_valid = map(apply, side_effect_valid)
valid_inputs = compress(inputs, side_effect_valid)
name = next(valid_inputs)


Which can be neatly expressed as two statements (I'm struggling to
got it to one without those evil lambdas):

from functools import partial
from operator import getitem, ge, methodcaller
from itertools import compress, tee

inputs, valid = tee(iter(partial(input, Enter your name: ), ...))

name = next(
compress(
inputs,
map(
methodcaller(__call__),
map(
partial(
getitem,
[
partial(print, No name longer than 20 letters.),
partial(getitem, [True], 0)
]
),
map(
partial(ge, 20),
map(len, valid)
)
)
)
)
)


Beautiful, see?


Of course, the most powerful function deals with this much more quickly:

exec(
while True:
name = input(Enter your name: )

if len(name) = 20:
break

else:
print(No name longer than 20 letters.)
)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 6:00 μμ, ο/η rusi έγραψε:

On Monday, July 1, 2013 7:31:18 PM UTC+5:30, Walter Hurry wrote:

Please...enough. Polite request: consider killfiling him and having done
with it.


It is irritating to see all the responses even though I killfiled him
long ago. Whilst I realise, of course, that it is entirely your
prerogative to choose what to do, I have no doubt that many others feel
as I do.


Walter I would humbly suggest that you consider that the real problem here is the 
many others not speaking up.

And that is at least in part happening because of the wrong use of tools -- 
wrong uses that you are advocating above.

To wit:

1. Kill-filing/spam-filtering are tools for spam.
Nikos is certainly not spamming in the sense of automated sending out of cooked 
mail to zillions of recipients/lists.  His posts are definite and intentional

2. Likewise Nikos is not trolling.
A troll is someone who posts seemingly innocuous stuff to cause irritation and 
then enjoys the results.  Here he clearly wants answers to the questions he is 
asking

So I suggest that if we want to address this problem we need to sit back 
individually and collectively, put aside habitual labels like spam/troll, and 
likewise habits of mind, and ask what exactly is the problem we are dealing 
with.



It feels good to see that some people in this list understand that i all 
i wanted was to only receive helpful replies, because i was and still am 
a newbie at Python and it was not a trolling act as falsely considered..


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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 6:34 μμ, ο/η Steven D'Aprano έγραψε:

The above of course assumes that I have not kill-filed you for
continuing to be abusive on-list.

So, Steven you want me to sit tight and read all the insults coming from
this guy?

If that happened to you, wouldn't you feel the need and urge to reply
back and stand for yourself?

Stand up for yourself and be abusive are two different things. I told
you, I don't care what you do off-list, but if you continue flaming on-
list, I will kill-file you.


I was name called directly, as incompetent jerk, thats a 
straightforward insult, so i responded back to him in the same manner.


I'm not saying it was a nice thing to do, but i just had enough.


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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 1 July 2013 16:49, rusi rustompm...@gmail.com wrote:
 On Monday, July 1, 2013 9:04:11 PM UTC+5:30, Steven D'Aprano wrote:
  And no, i do not want to piss off people like you, who have spend time
  helping me.
 Too late. I asked you to stop flaming on-list, and you didn't. I am now
 kill-filing you for a month. Feel grateful that it is not permanent, and
 take this time to reflect that you are running out of people willing to
 help you.

 A suggestion (request??) to all list members in this respect:

 We strengthen Steven's decision as follows:

 For the next month (till 1st August)
 - No discussions about Nikos specifically or trolling/flaming in general
 - No answers to anything he asks

(This does not target you, but is a response to your suggested response)

No, it's:

1) Insults and off-topic derogatory are not allowed.

That's it. If you're insulted, tough. Take it off-list. If you think
it's totally and unabashedly Nikos's fault, tough. Take it off-list.
If you think Nikos is completely innocent, tough. Take it off-list.

Insults and derogatory are not cool. I thought we were adults. If you
choose to ignore Nikos's posts, fine. If you choose like me to wait
until he asks questions well, fine. Whatever. That's beside the point.

As before. no insults, no derogatory. If you don't get why this is not
allowed, you need to step back.

To put things in perspective, these are the people who have been
insulting on this post:

Mark Lawrence (once, probably without meaning to be insulting)
Nikos
Antoon Pardon

And here are the people who have reminded them to stop:

Steve Simmons
Steven D'Aprano
Andrew Berg
Walter Hurry
rusi
Joshua Landau (me)

So yes, Antoon Pardon and Nikos, please stop. You are not representing
the list. I haven't followed any of the other arguments, true, but you
two in particular are causing a lot of trouble for the rest of us. It
is not hard to avoid making your disagreements public.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Νίκος

Στις 1/7/2013 7:56 μμ, ο/η Joshua Landau έγραψε:

So yes, Antoon Pardon and Nikos, please stop. You are not representing
the list. I haven't followed any of the other arguments, true, but you
two in particular are causing a lot of trouble for the rest of us. It
is not hard to avoid making your disagreements public.


I promise i will not reply to him any more even if still provoked.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 1 July 2013 18:15, Νίκος ni...@superhost.gr wrote:
 Στις 1/7/2013 7:56 μμ, ο/η Joshua Landau έγραψε:

 So yes, Antoon Pardon and Nikos, please stop. You are not representing
 the list. I haven't followed any of the other arguments, true, but you
 two in particular are causing a lot of trouble for the rest of us. It
 is not hard to avoid making your disagreements public.


 I promise i will not reply to him any more even if still provoked.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread rusi
On Monday, July 1, 2013 10:26:21 PM UTC+5:30, Joshua Landau wrote:
 So yes, Antoon Pardon and Nikos, please stop. You are not representing
 the list. 

This 'and' is type-wrong.

 I haven't followed any of the other arguments, true, but you
 two in particular are causing a lot of trouble for the rest of us. 

This thread only makes sense in the context of the last year of threads 
culminating in the last month of bullshit that this list is drowning under.

 It is not hard to avoid making your disagreements public.

The reverse is also true in general and more appropriate in this case.
Sometimes the consequences of not speaking up are more tragic than speaking too 
much, see
http://en.wikipedia.org/wiki/First_they_came...#The_text

Yeah sure, abusive posts, derogatory remarks, snide baiting etc is a problem.

However when you take Alex sarcastic comment
rename comp.lang.python to comp.support.superhost
and see the seriousness behind the sarcasm, you would find a considerably 
bigger problem -- the python list is stopping to be a python list.

In short if you agree and expand on only the first part of my request

 - No discussions about Nikos specifically or trolling/flaming in general

without the second

 - No answers to anything he asks

then we are not in agreement.

Let me end with 2 points:
1. If this discussion is to go beyond name-calling and over-specific, 
under-effective bandaids to getting a real grasp of the problem and hopefully a 
real solution, it would be good if people could familiarize themselves with the 
paradigm called tragedy of the commons
http://www.systems-thinking.org/arch/arch.htm#archtc

2. Steven's I am kill-filing you for a month will have a salutary effect on 
all only if we all do it.
-- 
http://mail.python.org/mailman/listinfo/python-list


PYTHONPATH and module names

2013-07-01 Thread Tobiah

So today, I created a file called 'formatter.py',
and my program broke.  It turned out that I was
also import 'gluon' from web2py, which in turn,
somewhere, imported the regular python formatter.py
with which I was not familiar.

So the question is: Does one simply always have
to be knowledgeable about existing python library
names, or is having '.' in the python path just
a bad idea?  Is there a way, not having '.' in
the path to explicitly specify the current directory?
Something analogous to import ./foo ?

Thanks,

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


Re: PYTHONPATH and module names

2013-07-01 Thread rusi
On Monday, July 1, 2013 11:59:35 PM UTC+5:30, Tobiah wrote:
 So today, I created a file called 'formatter.py',
 and my program broke.  It turned out that I was
 also import 'gluon' from web2py, which in turn,
 somewhere, imported the regular python formatter.py
 with which I was not familiar.
 
 So the question is: Does one simply always have
 to be knowledgeable about existing python library
 names, or is having '.' in the python path just
 a bad idea?  Is there a way, not having '.' in
 the path to explicitly specify the current directory?
 Something analogous to import ./foo ?

Are you familiar with absolute and relative imports:
http://docs.python.org/release/2.5/whatsnew/pep-328.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon

Op 01-07-13 16:01, Walter Hurry schreef:

On Mon, 01 Jul 2013 10:56:54 +0200, Antoon Pardon wrote:


Op 01-07-13 09:55, Νίκος schreef:

Στις 1/7/2013 9:37 πμ, ο/η Antoon Pardon έγραψε:

Remember that Nick is as much a human as all of us, he is bound to
have his feelings hurt when so many people pick on him -- whether
they are justified or not.


So? Should we particularly care about Nikos's feelings? Nikos is not
the victim, he is the instigator. And should his feelings get hurt
when it is pointed out what picture people got from him through his
own behaviour, I say good. May that way he'll learn that if he doesn't
want to be considered an incompetent inconsiderate jerk, he shouldn't
behave like one.


Well, i will also follow your advice and not care at all about your
feeling when you read the following.


This makes no sense. You are not following my advice, if you were
already behaving like this.



GO FUCK YOURSELF.



No thanks, I'm getting a little old for that.


Please...enough. Polite request: consider killfiling him and having done
with it.

It is irritating to see all the responses even though I killfiled him
long ago. Whilst I realise, of course, that it is entirely your
prerogative to choose what to do, I have no doubt that many others feel
as I do.


How about the following comprimise. I'll get myself a second identity.
Every respons I make to Nikos will be done with the same identity.
Normal python exchanges will be done with the other. You can then
simply killfile my identity that engages with Nikos.

Let me know what you think about this.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon

Op 01-07-13 18:56, Joshua Landau schreef:


To put things in perspective, these are the people who have been
insulting on this post:

Mark Lawrence (once, probably without meaning to be insulting)
Nikos
Antoon Pardon


I don't consider something insulting if it can be supported
by argument and evidence.

I stand by my statement that Nikos behaved like incompetent
inconsidered jerk can be supported as such. So if this
is insulting it only is in the same matter that the
truth can be insulting.


And here are the people who have reminded them to stop:

Steve Simmons
Steven D'Aprano
Andrew Berg
Walter Hurry
rusi
Joshua Landau (me)

So yes, Antoon Pardon and Nikos, please stop. You are not representing
the list. I haven't followed any of the other arguments, true, but you
two in particular are causing a lot of trouble for the rest of us. It
is not hard to avoid making your disagreements public.


Well nobody is representing the list. So where does that leave us?
And perhaps I am causing a lot of trouble, that doesn't mean I am
wrong. Maybe it is time to question the way this list in general
tries to avoid trouble.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 1 July 2013 19:29, rusi rustompm...@gmail.com wrote:
 On Monday, July 1, 2013 10:26:21 PM UTC+5:30, Joshua Landau wrote:
 So yes, Antoon Pardon and Nikos, please stop. You are not representing
 the list.

 This 'and' is type-wrong.

I don't follow.

 I haven't followed any of the other arguments, true, but you
 two in particular are causing a lot of trouble for the rest of us.

 This thread only makes sense in the context of the last year of threads 
 culminating in the last month of bullshit that this list is drowning under.

Yes, but I followed that. What I haven't followed are the
probably-100-post-long wars that are happening in other threads
between specific individuals who I can't be bothered to look up. So I
don't know who else has been slandering off of this thread.

 It is not hard to avoid making your disagreements public.

 The reverse is also true in general and more appropriate in this case.
 Sometimes the consequences of not speaking up are more tragic than speaking 
 too much, see
 http://en.wikipedia.org/wiki/First_they_came...#The_text

That's hardly relevant. Nikos isn't targeting any minority.

 Yeah sure, abusive posts, derogatory remarks, snide baiting etc is a problem.

 However when you take Alex sarcastic comment
 rename comp.lang.python to comp.support.superhost
 and see the seriousness behind the sarcasm, you would find a considerably 
 bigger problem -- the python list is stopping to be a python list.

No it hasn't. Nikos is a fraction of this list, and over the past
while has shrunk far below his peak. The people spewing insults
(including Nikos, but he's said he'll stop and I respect him for that)
are a much more voluminous sect of this list and a much bigger
problem.

 In short if you agree and expand on only the first part of my request

 - No discussions about Nikos specifically or trolling/flaming in general

I don't care whether people discuss Nikos. I care whether they
insult people, flame people and whether they act derogatorily. That is
uncalled for. Python-List is known for going off-topic, *but we should
not be known for insults*. This is especially true as only two people
have been insulting on this thread -- none of the others have endorsed
it. If [http://en.wikipedia.org/wiki/First_they_came...#The_text]
applies to any situation here, it's your lack of appreciation of the
fact that these insults are harming people.

 without the second

 - No answers to anything he asks

 then we are not in agreement.

And that is why I disagreed with you. I feel that your post implied
either everyone STFU or I'm OK with insults. It's not that. It's
STFU, or don't, but insults are not OK. Ever.

 Let me end with 2 points:
 1. If this discussion is to go beyond name-calling and over-specific, 
 under-effective bandaids to getting a real grasp of the problem and hopefully 
 a real solution, it would be good if people could familiarize themselves with 
 the paradigm called tragedy of the commons
 http://www.systems-thinking.org/arch/arch.htm#archtc

That doesn't apply here.

 2. Steven's I am kill-filing you for a month will have a salutary effect on 
 all only if we all do it.

Good for him. I prefer not to kill-fire - I don't even know how yet -
because it's easy enough to ignore posts. But that's fine - it's his
choice and it's not a bad one.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Antoon Pardon

Op 01-07-13 17:33, Steven D'Aprano schreef:

On Mon, 01 Jul 2013 15:08:18 +0200, Antoon Pardon wrote:


Op 01-07-13 14:43, Steven D'Aprano schreef:


Νίκος, I am not going to wade through this long, long thread to see
what problem you are trying to solve today.


Nikos is not trying to solve a problem in this thread. What happened is
that the original poster here got a rather short answer to his question.
Mark Laurence reacted questioning why this person didn't get the same
kind of treatment as Nick the Incompetant Greek. Then Nikos came in
with an insulting remark. The rest developed from their.


Okay, thank you for explaining the situation.

Now, please stop baiting Nikos.


I am not baiting Nikos. I know he mentions this two week period but all
I have done in the last two weeks that involves Nikos as a subject is
the Don't feed the troll thread and today this thread.

So if he feels baited for the last two weeks, it is either by that
Don't feed the troll thread or I have very little to do with it.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread rusi
On Tuesday, July 2, 2013 12:46:40 AM UTC+5:30, Joshua Landau wrote:
 On 1 July 2013 19:29, rusi  wrote:
 
  On Monday, July 1, 2013 10:26:21 PM UTC+5:30, Joshua Landau wrote:
 
  So yes, Antoon Pardon and Nikos, please stop. You are not representing
  the list.
  This 'and' is type-wrong.
 I don't follow.

Yes that's evident.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:12, Antoon Pardon antoon.par...@rece.vub.ac.be wrote:
 Op 01-07-13 18:56, Joshua Landau schreef:


 To put things in perspective, these are the people who have been
 insulting on this post:

 Mark Lawrence (once, probably without meaning to be insulting)
 Nikos
 Antoon Pardon


 I don't consider something insulting if it can be supported
 by argument and evidence.

 I stand by my statement that Nikos behaved like incompetent
 inconsidered jerk can be supported as such. So if this
 is insulting it only is in the same matter that the
 truth can be insulting.

Well then you are wrong. But fine, I'll use your definition incorrect
as it may be (when talking to you, please don't misrepresent my other
posts).

Nevertheless, these statements that we are talking about, that I shall
now term pseudo-insults, are unwanted and not called for. Please
keep them off-list.

 And here are the people who have reminded them to stop:

 Steve Simmons
 Steven D'Aprano
 Andrew Berg
 Walter Hurry
 rusi
 Joshua Landau (me)

 So yes, Antoon Pardon and Nikos, please stop. You are not representing
 the list. I haven't followed any of the other arguments, true, but you
 two in particular are causing a lot of trouble for the rest of us. It
 is not hard to avoid making your disagreements public.


 Well nobody is representing the list. So where does that leave us?

I am afraid you are wrong. The body of people of this list, as a
whole, represent this list. As a whole, as I have shown, they resent
your pseudo-insults. rusi is an exception, who only seems to resent
Nikos's, but rusi has not fallen to pseudo-insults himself (herself?).

 And perhaps I am causing a lot of trouble, that doesn't mean I am
 wrong. Maybe it is time to question the way this list in general
 tries to avoid trouble.

Irrelevant. Your pseudo-insults are unwanted. Please stop. Argue all
you want - I'm not going to judge who's right. But I'd rather you
appreciate that no-one wants your pseudo-insults on this list.
-- 
http://mail.python.org/mailman/listinfo/python-list


python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread Joel Goldstick
I copied the original question so that the rant on the other thread
can continue.  Let's keep this thread ontopic


number_drawn=()
def load(lot_number,number_drawn):
first=input(enter first lot: )
last=input(enter last lot: )
for lot_number in range(first,last):
line_out=str(lot_number)
for count in range(1,5):
number_drawn=raw_input(number: )
line_out=line_out+(number_drawn)
print line_out
finale_line.append(line_out)
finale_line2=finale_line

load(lot_number,number_drawn)


print finale_line
print( *4),
for n in range(1,41):
print n,  #this is to produce a line of numbers to compare to
output#
for a in finale_line:
print\n,
print a[0], ,
space_count=1
for b in range(1,5):
if int(a[b])10:
 print( *(int(a[b])-space_count)),int(a[b]),
 space_count=int(a[b])
else:
print( *(a[b]-space_count)),a[b],
space_count=a[b]+1







number_drawn=()
def load(lot_number,number_drawn):
first=input(enter first lot: )
last=input(enter last lot: )
for lot_number in range(first,last):
line_out=str(lot_number)
for count in range(1,5):
number_drawn=raw_input(number: )
line_out=line_out+(number_drawn)
print line_out
finale_line.append(line_out)
finale_line2=finale_line

load(lot_number,number_drawn)


print finale_line
print( *4),
for n in range(1,41):
print n,  #this is to produce a line of numbers to compare to
output#
for a in finale_line:
print\n,
print a[0], ,
space_count=1
for b in range(1,5):
if int(a[b])10:
 print( *(int(a[b])-space_count)),int(a[b]),
 space_count=int(a[b])
else:
print( *(a[b]-space_count)),a[b],
space_count=a[b]+1








this generates
type 'list'
enter first lot: 1
enter last lot: 4
number: 2
number: 3
number: 4
number: 5
12345
number: 1
number: 2
number: 3
number: 4
21234
number: 3
number: 4
number: 5
number: 6
33456
['12345', '21234', '33456']
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39 40
1 2   3   4   5
21   2   3   4
3  3   4   5   6
#as you can see many numbers are between the lines of a normal print#
#I thought this was due to white space int he format .So I tried  a list
of strings and got the same results.#



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


Re: Stupid ways to spell simple code

2013-07-01 Thread Marcin Szamotulski
On 17:30 Mon 01 Jul , Joshua Landau wrote:
 On 1 July 2013 14:14, Chris Angelico ros...@gmail.com wrote:
  On Mon, Jul 1, 2013 at 10:59 PM, Neil Cerutti ne...@norwich.edu wrote:
  On 2013-06-30, Chris Angelico ros...@gmail.com wrote:
  So, here's a challenge: Come up with something really simple,
  and write an insanely complicated - yet perfectly valid - way
  to achieve the same thing. Bonus points for horribly abusing
  Python's clean syntax in the process.
 
  Go on, do your worst!
 
  I've often thought it was redundant for Python to support 'if'
  when it has dictionaries, cf the rationale for having no
  'switch'.
 
  valid_name = None
  while not valid_name:
  name = input(Enter your name: )
  valid_name = {
  True: lambda: print(No name longer than 20 letters.),
  False: lambda: True,
  }[len(name)  20]()
 
  Much better.
 
  Good! Good! But, wh. Wh.
 
  def get_name():
while True:
  name = input(Enter your name: )
  yield {
  True: lambda: print(No name longer than 20 letters.),
  False: lambda: name,
  }[len(name)  20]()
  name = next(filter(None,get_name()))
 
 Oh, cruel. But you can do worse. Who needs while when you have
 filter(iter(FUNCTION, object()))?
 
 def get_name():
 name = input(Enter your name: )
 return [
 lambda: name,
 lambda: print(No name longer than 20 letters.),
 ][len(name)  20]()
 
 name = next(filter(None, iter(get_name, object(
 
 
 But who needs *any* of this! Defining functions is so old-hat. It's
 all already in the standard library (using only assignments and 
 function-calls):
 
 from functools import partial
 from operator import getitem, ge, methodcaller
 from itertools import compress, tee
 apply = methodcaller(__call__)
 ret_true = partial(getitem, [True], 0)
 print_invalid = partial(print, No name longer than 20 letters.)
 inputs = iter(partial(input, Enter your name: ), ...)
 inputs, valid = tee(inputs)
 valid = map(len, valid)
 valid = map(partial(ge, 20), valid)
 side_effect_valid = map(partial(getitem, [print_invalid, ret_true]), valid)
 side_effect_valid = map(apply, side_effect_valid)
 valid_inputs = compress(inputs, side_effect_valid)
 name = next(valid_inputs)
 
 
 Which can be neatly expressed as two statements (I'm struggling to
 got it to one without those evil lambdas):
 
 from functools import partial
 from operator import getitem, ge, methodcaller
 from itertools import compress, tee
 
 inputs, valid = tee(iter(partial(input, Enter your name: ), ...))
 
 name = next(
 compress(
 inputs,
 map(
 methodcaller(__call__),
 map(
 partial(
 getitem,
 [
 partial(print, No name longer than 20 letters.),
 partial(getitem, [True], 0)
 ]
 ),
 map(
 partial(ge, 20),
 map(len, valid)
 )
 )
 )
 )
 )
 
 
 Beautiful, see?
 
 
 Of course, the most powerful function deals with this much more quickly:
 
 exec(
 while True:
 name = input(Enter your name: )
 
 if len(name) = 20:
 break
 
 else:
 print(No name longer than 20 letters.)
 )
 -- 
 http://mail.python.org/mailman/listinfo/python-list


Here is another example which I came across when playing with
generators, the first function is actually quite useful, the second
generator is the whole fun:

from functools import wraps
def init(func):
decorator which initialises the generator

@wraps(func)
def inner(*args, **kwargs):
g = func(*args, **kwargs)
g.send(None)
return g
return inner

@init
def gen(func):
 x = (yield)
 while True:
 x = (yield func(x))


now if you have function f
def f(arg):
return arg**2

then calling f(5) is the same as

g = gen(f)
g.send(5)


I wrote a blog post where I did include this as a `useless` example:
http://pycorner.herokuapp.com/blog/5

Best regards,
Marcin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:18, Antoon Pardon antoon.par...@rece.vub.ac.be wrote:
 Op 01-07-13 17:33, Steven D'Aprano schreef:

 On Mon, 01 Jul 2013 15:08:18 +0200, Antoon Pardon wrote:

 Op 01-07-13 14:43, Steven D'Aprano schreef:

 Νίκος, I am not going to wade through this long, long thread to see
 what problem you are trying to solve today.


 Nikos is not trying to solve a problem in this thread. What happened is
 that the original poster here got a rather short answer to his question.
 Mark Laurence reacted questioning why this person didn't get the same
 kind of treatment as Nick the Incompetant Greek. Then Nikos came in
 with an insulting remark. The rest developed from their.


 Okay, thank you for explaining the situation.

 Now, please stop baiting Nikos.


 I am not baiting Nikos. I know he mentions this two week period but all
 I have done in the last two weeks that involves Nikos as a subject is
 the Don't feed the troll thread and today this thread.

 So if he feels baited for the last two weeks, it is either by that
 Don't feed the troll thread or I have very little to do with it.

Obviously Steven, as I do, considers your actions in this thread as
baiting. Whether or not you agree with his definition of baiting, he
wants you to stop.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread Joshua Landau
On 1 July 2013 20:32, Joel Goldstick joel.goldst...@gmail.com wrote:
 I copied the original question so that the rant on the other thread can
 continue.  Let's keep this thread ontopic

Thank you. I shall do the same below. Unfortunately I don't have high
hopes that any progress will be made on this thread -- Charles Benoit
hasn't made a single reply since his original post.


On 29 June 2013 03:07, charles benoit feather.duster.kung...@gmail.com wrote:
STUFF

1) You haven't asked a question.

2) You posted your code twice. That makes it look a lot harder and
longer than it really is.

3) Give us a *minimal* reproducible test case. I currently just get:

%~ python2 /tmp/nd.py
Traceback (most recent call last):
  File /tmp/nd.py, line 12, in module
finale_line2=finale_line
NameError: name 'finale_line' is not defined

This isn't the only problem.

In other words, you've given us an unsolvable problem. Try again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH and module names

2013-07-01 Thread Tobiah

Are you familiar with absolute and relative imports:
http://docs.python.org/release/2.5/whatsnew/pep-328.html


Doesn't seem to work:

Python 2.7.3 (default, May 10 2012, 13:31:18)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type help, copyright, credits or license for more information.
 from __future__ import absolute_import
 import .format
  File stdin, line 1
import .format
   ^
SyntaxError: invalid syntax


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


Re: Issues compiling hunspell from source on windows

2013-07-01 Thread Akshay Kayastha
I installed a 32 bit python and it still gives me the same error. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread Dave Angel

On 07/01/2013 03:32 PM, Joel Goldstick wrote:

I copied the original question so that the rant on the other thread
can continue.  Let's keep this thread ontopic


number_drawn=()
def load(lot_number,number_drawn):
 first=input(enter first lot: )
 last=input(enter last lot: )
 for lot_number in range(first,last):
 line_out=str(lot_number)
 for count in range(1,5):
 number_drawn=raw_input(number: )
 line_out=line_out+(number_drawn)
 print line_out
 finale_line.append(line_out)
finale_line2=finale_line

load(lot_number,number_drawn)


print finale_line
print( *4),
for n in range(1,41):
 print n,  #this is to produce a line of numbers to compare to
output#
for a in finale_line:
 print\n,
 print a[0], ,
 space_count=1
 for b in range(1,5):
 if int(a[b])10:
  print( *(int(a[b])-space_count)),int(a[b]),
  space_count=int(a[b])
 else:
 print( *(a[b]-space_count)),a[b],
 space_count=a[b]+1











  Duplicate code removed





 this generates
type 'list'
enter first lot: 1
enter last lot: 4
number: 2
number: 3
number: 4
number: 5
12345
number: 1
number: 2
number: 3
number: 4
21234
number: 3
number: 4
number: 5
number: 6
33456
['12345', '21234', '33456']
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39 40
1 2   3   4   5
21   2   3   4
3  3   4   5   6

#as you can see many numbers are between the lines of a normal print#

#I thought this was due to white space int he format .So I tried  a list
of strings and got the same results.#



But what was the expected output?  And who cares?  The code made no 
sense, was incomplete, and the posted question was nonsensical.


If the OP has abandoned it, so should we.

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


Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread rusi
On Tuesday, July 2, 2013 1:32:44 AM UTC+5:30, Dave Angel wrote:
 But what was the expected output?  And who cares?  The code made no 
 sense, was incomplete, and the posted question was nonsensical.

Yes in this specific instance all this is probably true.
I believe however, that Joel's intent in reposting this is more global (and 
important) in its scope, viz:

If this list persists in the current unhealthy state which it is experiencing, 
authentic noob questions will get buried in mountains of bullshit.

Note: I find Joshua's answer fine given the question.

 If the OP has abandoned it, so should we.

If you were a noob-OP who asked that question and the result unfolded as it 
has, what would you do?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH and module names

2013-07-01 Thread rusi
On Tuesday, July 2, 2013 1:24:30 AM UTC+5:30, Tobiah wrote:
  Are you familiar with absolute and relative imports:
  http://docs.python.org/release/2.5/whatsnew/pep-328.html
 
 Doesn't seem to work:
 Python 2.7.3 (default, May 10 2012, 13:31:18)
 [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
 Type help, copyright, credits or license for more information.
   from __future__ import absolute_import
   import .format
File stdin, line 1
  import .format
 ^
 SyntaxError: invalid syntax
  

1. My reading of 
http://www.python.org/dev/peps/pep-0328/
is that this only works for from statements not import statements.
[See the section called Guido's decision]

2. The __future__ is not necessary in python 2.7
[Not necessary or not allowed I not know :-) ]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH and module names

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 14:38:50 -0700, rusi wrote:

 On Tuesday, July 2, 2013 1:24:30 AM UTC+5:30, Tobiah wrote:
  Are you familiar with absolute and relative imports:
  http://docs.python.org/release/2.5/whatsnew/pep-328.html
 
 Doesn't seem to work:
 Python 2.7.3 (default, May 10 2012, 13:31:18) [GCC 4.2.4 (Ubuntu
 4.2.4-1ubuntu4)] on linux2 Type help, copyright, credits or
 license for more information.
   from __future__ import absolute_import import .format
File stdin, line 1
  import .format
 ^
 SyntaxError: invalid syntax
  
  
 1. My reading of
 http://www.python.org/dev/peps/pep-0328/ is that this only works for
 from statements not import statements. [See the section called Guido's
 decision]


Correct. This would have to be written as:

from . import format


but note that this only work in a package, not from some arbitrary module 
inside a directory.


 
 2. The __future__ is not necessary in python 2.7 [Not necessary or not
 allowed I not know :-) ]

Not necessary.

__future__ statements are guaranteed to work in all future versions, in 
the sense that once a __future__ feature is added, it will never be 
removed. So Python has had nested scopes since version 2.2 (by memory), 
but:

from __future__ import nested_scopes

still is allowed in Python 3.3, even though it has been a no-op since 2.2 
or 2.3.


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


Re: Stupid ways to spell simple code

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote:

 Here is another example which I came across when playing with
 generators, the first function is actually quite useful, the second
 generator is the whole fun:
 
 from functools import wraps
 def init(func):
 decorator which initialises the generator 
 @wraps(func)
 def inner(*args, **kwargs):
 g = func(*args, **kwargs)
 g.send(None)
 return g
 return inner
 
 @init
 def gen(func):
  x = (yield)
  while True:
  x = (yield func(x))
 
 
 now if you have function f
 def f(arg):
 return arg**2
 
 then calling f(5) is the same as
 
 g = gen(f)
 g.send(5)



I think you must be missing an important part of the trick, because 
calling f(5) returns 25. It's not:

@gen
def f(arg):
return arg**2


because that raises TypeError.




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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Steven D'Aprano
On Mon, 01 Jul 2013 20:42:48 +0200, Antoon Pardon wrote:

 How about the following comprimise. I'll get myself a second identity.
 Every respons I make to Nikos will be done with the same identity.
 Normal python exchanges will be done with the other. You can then simply
 killfile my identity that engages with Nikos.

Please don't assault people in the street.

How about a compromise? I'll continue assaulting people in the street, 
but I'll wear a yellow hat when I do so. Then, if you don't want to see 
me assaulting people, whenever you see me wearing a yellow hat, just turn 
away.


 Let me know what you think about this.

Sure, no problem.

*plonk*



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


Re: PYTHONPATH and module names

2013-07-01 Thread Fábio Santos
On 1 Jul 2013 20:58, Tobiah t...@tobiah.org wrote:

 Are you familiar with absolute and relative imports:
 http://docs.python.org/release/2.5/whatsnew/pep-328.html


 Doesn't seem to work:

 Python 2.7.3 (default, May 10 2012, 13:31:18)
 [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
 Type help, copyright, credits or license for more information.
  from __future__ import absolute_import
  import .format
   File stdin, line 1
 import .format
^
 SyntaxError: invalid syntax
 

Have you tried

from . import format

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Denis McMahon
On Mon, 01 Jul 2013 21:18:26 +0200, Antoon Pardon wrote:

 I am not baiting Nikos.

Your opinion, mine differs.

 all I have done in the last two weeks that involves Nikos as a 
 subject is the Don't feed the troll thread 

Calling him a troll is baiting. Please stop.

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Denis McMahon
On Mon, 01 Jul 2013 20:42:48 +0200, Antoon Pardon wrote:

 How about the following comprimise. 

 Let me know what you think about this.

How about you just ignore him.

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


Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread Dave Angel

On 07/01/2013 05:16 PM, rusi wrote:

On Tuesday, July 2, 2013 1:32:44 AM UTC+5:30, Dave Angel wrote:

   SNIP




Yes in this specific instance all this is probably true.
I believe however, that Joel's intent in reposting this is more global (and 
important) in its scope, viz:

If this list persists in the current unhealthy state which it is experiencing, 
authentic noob questions will get buried in mountains of bullshit.

Note: I find Joshua's answer fine given the question.


If the OP has abandoned it, so should we.


If you were a noob-OP who asked that question and the result unfolded as it 
has, what would you do?



Point well-taken.  So I'll see what I can do here.  I'll put comments on 
lines I had to add or change.



finale_line = []#missing initialization
lot_number = 99

number_drawn=()
def load(lot_number,number_drawn):
first=input(enter first lot: )
last=input(enter last lot: )
for lot_number in range(first,last):
line_out=str(lot_number)
for count in range(1,5):
number_drawn=raw_input(number: )
line_out=line_out+(number_drawn)
print line_out
finale_line.append(line_out)

#finale_line2=finale_line #not referenced

load(lot_number,number_drawn)


print finale_line
print( *4),
for n in range(1,41):
print n,  #this is to produce a line of numbers to
  #compare to output#
for a in finale_line:
print\n,
print a[0], ,
space_count=1
for b in range(1,5):
if int(a[b])10:
 print( *(int(a[b])-space_count)),int(a[b]),
 space_count=int(a[b])
else:
pass
#print( *(a[b]-space_count)),a[b],   #dead code
#space_count=a[b]+1#dead code

Since all the numbers are butted together in the string  line_out, the 
later logic is iterating over digits, which cannot be bigger than 9.  So 
the else clause is nonsensical.  Even if they were to run, they'd give 
runtime errors.


 #as you can see many numbers are between the lines of a normal print#
 #I thought this was due to white space int he format .So I tried  a 
 list

 of strings and got the same results.#

No clue what that means.  What numbers are between what lines?  And what 
is a normal print?


Presumably the intent was to somehow do a variable spacing of those digits.


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


Re: python adds an extra half space when reading froma string or list -- back to the question

2013-07-01 Thread alex23

On 2/07/2013 5:32 AM, Joel Goldstick wrote:

I copied the original question so that the rant on the other

 thread can continue.  Let's keep this thread ontopic

You've included the same set of code twice. Also, it doesn't run as is,
so you haven't reduced it to a minimal working example for us to test.

Python's print adds a space where there's a comma, try this at the
interactive prompt:

 print 'a','b'
a b

I don't think you're taking this into account. There are quite a few 
other problems with your code, though:



number_drawn=()
def load(lot_number,number_drawn):


You've assigned `number_drawn` to a tuple, which is an immutable type. 
Within the `load` function you then do:


  number_drawn=raw_input(number: )

Which just re-assigns `number_drawn` to the output of the `raw_input`
function _within the function itself_. The value isn't available
outside of the function, if that is what you're intending. You also
haven't defined `lot_number` in your code, and again you re-assign it
within the body of the `load` function:

  for lot_number in range(first,last):

Which has no impact on any global definition. Since you're not actually
passing values into the function you can probably do without both
arguments and just go with:

def load():

  first=input(enter first lot: )
  last=input(enter last lot: )

You should never use `input`, it evaluates the expression entered.
Always use `raw_input` unless you absolutely know what you're doing.

  for lot_number in range(first,last):

`range` will start at `first` and finish _at but not including `last`. 
If you want 4 lines when you enter first=1 and last=4, then you need to 
increment `last` by 1:


for lot_number in range(first,last+1):


 finale_line.append(line_out)


Where is `finale_line` defined? You haven't shown it but my guess is 
you've made it an empty list. You're also not returning anything from 
the function, which implies you're relying on global scope to hold the 
result. This is bad practice. You should start your function with:


finale_line = []

And then end it with:

return finale_line

Which would allow you to replace:


finale_line2=finale_line
load(lot_number,number_drawn)


With:

finale_line = load()


for a in finale_line:
 print\n,
 print a[0], ,
 space_count=1
 for b in range(1,5):


This condition will _always_ be true:


 if int(a[b])10:


Because of the way you're stepping through `finale_line`, you're only 
ever looking at a single character, so that value will always be from 0
to 9. You clearly want to allow for double digit numbers, so not storing 
them all as a big string would be a good start. You're dealing

with numbers, so hold them as numbers in a list.

Here's a more flexible approach that I think does what you want:

import os

def load_numbers():
first=int(raw_input(enter first lot: ))
last=int(raw_input(enter last lot: ))
finale_line = []
for lot_number in range(first,last+1):
line_out = []
for count in range(1,5):
number_drawn=raw_input(lot %d, number %d:  %
(lot_number, count))
line_out.append(number_drawn)
finale_line.append((lot_number, line_out))
return finale_line

finale_line = load_numbers()

# get space needed from the maximum number entered
largest_number = max(
number for row,numbers in finale_line for number in numbers)
space_count = len(str(largest_number))

# get no. of columns from the first set of numbers
columns = len(finale_line[0][1])
# space to cover the lot numbers
print ' ',
# print the columns
for column in xrange(1, columns+1):
spacing = space_count - len(str(column))
print '%s%d' % (' '*spacing, column),

for lot, numbers in finale_line:
print os.linesep, # use the EOL used by the current
  # operating system
print lot,
for number in numbers:
spacing = space_count - len(str(number))
print '%s%d' % (' '*spacing, number),

However, if you want to make your life a _lot_ easier when printing
tabular data, I highly recommend using a library dedicated to just
that, something like:

https://code.google.com/p/prettytable/

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread alex23

On 1/07/2013 7:37 PM, Νίκος wrote:

I dont expect anyone to solve my problems,


This is not consistent with the number of HELP ME I BROKE MY BUSINESS
posts you've made.


iam happy if they point me to
a direction which i can solve it myself


This is not consistent with your repeated claim that you prefer people
to explain things to you rather than read documentation.

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


Re: Regular expression negative look-ahead

2013-07-01 Thread Jason Friedman
Found this:
http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python
.

This pattern seems to work:
pattern = re.compile(r^(?!.*(CTL|DEL|RUN)))

But I am not sure why.


On Mon, Jul 1, 2013 at 5:07 PM, Jason Friedman jsf80...@gmail.com wrote:

 I have table names in this form:
 MY_TABLE
 MY_TABLE_CTL
 MY_TABLE_DEL
 MY_TABLE_RUN
 YOUR_TABLE
 YOUR_TABLE_CTL
 YOUR_TABLE_DEL
 YOUR_TABLE_RUN

 I am trying to create a regular expression that will return true for only
 these tables:
 MY_TABLE
 YOUR_TABLE

 I tried these:
 pattern = re.compile(r_(?!(CTL|DEL|RUN)))
 pattern = re.compile(r\w+(?!(CTL|DEL|RUN)))
 pattern = re.compile(r(?!(CTL|DEL|RUN)$))

 But, both match.
 I do not need to capture anything.

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


OSError [Errno 26] ?!?!

2013-07-01 Thread Νίκος
After making a slightly chnage inside my pelatologio.py script 
substituting '*' instead of '-' for no apparent reason i receive 
the following error:


[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] OSError: [Errno 
26] \\u0391\\u03c1\\u03c7\\u03b5\\u03af\\u03bf 
\\u03ba\\u03b5\\u03b9\\u03bc\\u03ad\\u03bd\\u03bf\\u03c5 \\u03c3\\u03b5 
\\u03c7\\u03c1


What is this OSError and these unicode characters besided it?
Here is the complete traceback.

[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] Original 
exception was:, referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] Traceback (most 
recent call last):, referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148]   File 
/home/nikos/public_html/cgi-bin/metrites.py, line 222, in module, 
referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] pypage = 
subprocess.check_output( cgi_path + page ), referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148]   File 
/usr/local/lib/python3.3/subprocess.py, line 573, in check_output, 
referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] with 
Popen(*popenargs, stdout=PIPE, **kwargs) as process:, referer: 
http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148]   File 
/usr/local/lib/python3.3/subprocess.py, line 820, in __init__, 
referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] 
restore_signals, start_new_session), referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148]   File 
/usr/local/lib/python3.3/subprocess.py, line 1438, in _execute_child, 
referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] raise 
child_exception_type(errno_num, err_msg), referer: http://superhost.gr/
[Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] OSError: [Errno 
26] \\u0391\\u03c1\\u03c7\\u03b5\\u03af\\u03bf 
\\u03ba\\u03b5\\u03b9\\u03bc\\u03ad\\u03bd\\u03bf\\u03c5 \\u03c3\\u03b5 
\\u03c7\\u03c1\\u03ae\\u03c3\\u03b7, referer: http://superhost.gr/


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


Re: Stupid ways to spell simple code

2013-07-01 Thread 88888 Dihedral
Steven D'Aprano於 2013年7月2日星期二UTC+8上午6時09分18秒寫道:
 On Mon, 01 Jul 2013 20:36:29 +0100, Marcin Szamotulski wrote:
 
 
 
  Here is another example which I came across when playing with
 
  generators, the first function is actually quite useful, the second
 
  generator is the whole fun:
 
  
 
  from functools import wraps
 
  def init(func):
 
  decorator which initialises the generator 
 
  @wraps(func)
 
  def inner(*args, **kwargs):
 
  g = func(*args, **kwargs)
 
  g.send(None)
 
  return g
 
  return inner
 
  
 
  @init
 
  def gen(func):
 
   x = (yield)
 
   while True:
 
   x = (yield func(x))
 
  
 
  
 
  now if you have function f
 
  def f(arg):
 
  return arg**2
 
  
 
  then calling f(5) is the same as
 
  
 
  g = gen(f)
 
  g.send(5)
 
 
 
 
 
 
 
 I think you must be missing an important part of the trick, because 
 
 calling f(5) returns 25. It's not:
 
 
 
 @gen
 
 def f(arg):
 
 return arg**2
 
 
 
 
 
 because that raises TypeError.
 
 
 
 
 
 
 
 
 
 -- 
 
 Steven

Lets be serious about generators and iterators.

A generator can be used only once in a program
is different from a a generator method of a class that 
can produce several instances with generators of the same kind
but operated in each instance of the class.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread rusi
On Monday, July 1, 2013 8:36:53 PM UTC+5:30, Neil Cerutti wrote:
 On 2013-07-01, rusi wrote:
  1. Kill-filing/spam-filtering are tools for spam.
  Nikos is certainly not spamming in the sense of automated
  sending out of cooked mail to zillions of recipients/lists.
  His posts are definite and intentional
 
 I disagree. Kill-files are not only for spam. I filter out
 anything I believe I won't want to see.

I happen to be a champ in using a wrench to hammer screws into bricks.
Others do a better job I am told -- and without being champs :-)

Tools can be used right... and wrong.  Sufficiently extreme wrong use adds to 
the original problem/mess.

Kill-filing is a solution for one problem.  In the current context it is much 
more the problem than the solution.  Two cases:

1. My estimate is that about 30-40 *different* answers-ers in hundreds of 
different posts have expressed frustration with dealing with Nikos.  The fact 
that they are now silent can mean one of two cases:

a. Nikos has turned a new leaf and become a golden boy
b. The protesters have opted out of the discussion/system
(like so-called democracies where 20% of the populace vote and criminals come 
to power)
You can take your pick on which case (Hint: Read this thread)

2. I am killfiling you is bullying behavior.  It is worse than useless because
a. The problem cases couldn't care a hoot
b. Those who could contribute usefully are shut up
c. The messengers are being shot as substitute for the culprits

On the whole we techies have a penchant (may I say allure?) for solving 
problems technically rather than socially.
It works well up to a point:
Thou shall indent thy programs is a social requirement in C and technical in 
python.  And so we consider -- rightly -- that python advances C.

However this line cannot solve all problems.  Our belief that technology can 
solve all problems is directly linked to the impending fact that the planet may 
go up in smoke.

In short technology in its place is good but conscience is not substitutable:
the use of (tools like) kill-filing analogizes to this piece of medical logic:

Brain tumor causes headache
Aspirin cures headache
Therefore aspirin cures brain tumors

tl;dr

Nikos is not spamming/trolling/baiting/flaming.  The Nikos-threads are a more 
serious disease than all these.  The fact that this thread is not started by 
him suggests the disease is spreading.  By not speaking up one is colluding.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OSError [Errno 26] ?!?!

2013-07-01 Thread Cameron Simpson
On 02Jul2013 06:37, Νίκος ni...@superhost.gr wrote:
| After making a slightly chnage inside my pelatologio.py script
| substituting '*' instead of '-' for no apparent reason i
| receive the following error:
| 
| [Tue Jul 02 06:33:06 2013] [error] [client 46.12.97.148] OSError:
| [Errno 26] \\u0391\\u03c1\\u03c7\\u03b5\\u03af\\u03bf
| \\u03ba\\u03b5\\u03b9\\u03bc\\u03ad\\u03bd\\u03bf\\u03c5
| \\u03c3\\u03b5 \\u03c7\\u03c1

Errno 26 depends on your operating system. See man 2 intro for details.
But on my Mac and on a handle Linux system number 26 is:

   26 ETXTBSY Text file busy.  The new process was a pure procedure (shared
 text) file which was open for writing by another process, or
 while the pure procedure file was being executed an open call
 requested write access.

See the os.strerror function for printing the message from an errno number:

  http://docs.python.org/3/library/os.html#os.strerror

I'd say you're trying to write to a file you shouldn't be writing to.
Maybe an executable?

Try to get your script to print out the filename of whatever it was trying to
overwrite before the open() call.

Regarding the characters, I'd say they've been double escaped. Let's undo that:

  [/Users/cameron]fleet* py3
  Python 3.3.2 (default, May 21 2013, 11:50:47)
  [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on 
darwin
  Type help, copyright, credits or license for more information.
   print('\\u0391\\u03c1\\u03c7\\u03b5\\u03af\\u03bf 
\\u03ba\\u03b5\\u03b9\\u03bc\\u03ad\\u03bd\\u03bf\\u03c5 \\u03c3\\u03b5 
\\u03c7\\u03c1')
  \u0391\u03c1\u03c7\u03b5\u03af\u03bf 
\u03ba\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5 \u03c3\u03b5 \u03c7\u03c1
   print('\u0391\u03c1\u03c7\u03b5\u03af\u03bf 
\u03ba\u03b5\u03b9\u03bc\u03ad\u03bd\u03bf\u03c5 \u03c3\u03b5 \u03c7\u03c1')
  Αρχείο κειμένου σε χρ
  

I can't read that, but I'd hope you can.

| What is this OSError and these unicode characters besided it?
| Here is the complete traceback.

A traceback without code isn't terribly useful.

Cheers,
-- 
Cameron Simpson c...@zip.com.au
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PYTHONPATH and module names

2013-07-01 Thread Lele Gaifax
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:

 On Mon, 01 Jul 2013 14:38:50 -0700, rusi wrote:
 2. The __future__ is not necessary in python 2.7 [Not necessary or not
 allowed I not know :-) ]

 Not necessary.

IIRC that it is needed, to solve the OP problem: one thing is the
syntax, which under Python 2.7 is enabled by default, another thing is
the behaviour, that is whether the interpreter will give priority to the
sys.path.

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

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


Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Joshua Landau
On 2 July 2013 05:34, rusi rustompm...@gmail.com wrote:
 On Monday, July 1, 2013 8:36:53 PM UTC+5:30, Neil Cerutti wrote:
 On 2013-07-01, rusi wrote:
  1. Kill-filing/spam-filtering are tools for spam.
  Nikos is certainly not spamming in the sense of automated
  sending out of cooked mail to zillions of recipients/lists.
  His posts are definite and intentional

 I disagree. Kill-files are not only for spam. I filter out
 anything I believe I won't want to see.

 I happen to be a champ in using a wrench to hammer screws into bricks.
 Others do a better job I am told -- and without being champs :-)

That's not really valid, your proposed technique is use nothing, in
which case using a wrench is a golden opportunity. And you've also
implied that filtering out what you don't want is akin to hammering
screws into bricks, in which case I've been programming wrong my whole
programming life.

 Tools can be used right... and wrong.  Sufficiently extreme wrong use adds to 
 the original problem/mess.

 Kill-filing is a solution for one problem.  In the current context it is much 
 more the problem than the solution.  Two cases:

True, kill-filing *is* a solution for one problem. Don't get ahead of
yourself, though, by assuming that implies it's not a solution for
anything else.

 1. My estimate is that about 30-40 *different* answers-ers in hundreds of 
 different posts have expressed frustration with dealing with Nikos.  The fact 
 that they are now silent can mean one of two cases:

I'm struggling to make those numbers add up.

 a. Nikos has turned a new leaf and become a golden boy
 b. The protesters have opted out of the discussion/system
 (like so-called democracies where 20% of the populace vote and criminals come 
 to power)

First of all, the basis on which you claim there are only two cases is
false. Hence this point is void.

Secondly: wut? How is any of this a relevant point in the least?

 You can take your pick on which case (Hint: Read this thread)

 2. I am killfiling you is bullying behavior.  It is worse than useless 
 because

No it is not. You can check the definition of bully if you want.
Please try not to overuse emotionally rigged terms.

 a. The problem cases couldn't care a hoot

Nikos has shown that he does, in fact, care a hoot.

 b. Those who could contribute usefully are shut up

You wouldn't killfire someone whose posts you want to read.

 c. The messengers are being shot as substitute for the culprits

If what the messengers are talking unacceptably for your tastes, then
by all means you should have right not to listen. Is that not just
basic reasoning?
People aren't kill-firing because the messengers are telling truths
we don't want to hear. People are kill-firing because they're doing it
in ways that we don't find acceptable.

 On the whole we techies have a penchant (may I say allure?) for solving 
 problems technically rather than socially.
 It works well up to a point:
 Thou shall indent thy programs is a social requirement in C and technical 
 in python.  And so we consider -- rightly -- that python advances C.

 However this line cannot solve all problems.  Our belief that technology can 
 solve all problems is directly linked to the impending fact that the planet 
 may go up in smoke.

Wut?

 In short technology in its place is good but conscience is not substitutable:
 the use of (tools like) kill-filing analogizes to this piece of medical logic:

 Brain tumor causes headache
 Aspirin cures headache
 Therefore aspirin cures brain tumors

I see no connection. No connection to what this is supposedly an in
short of (despite being longer) and no connection to the actual point
you are trying to make. Basically, I don't understand what you're
trying to portray.

 tl;dr

 Nikos is not spamming/trolling/baiting/flaming.  The Nikos-threads are a more 
 serious disease than all these.  The fact that this thread is not started by 
 him suggests the disease is spreading.  By not speaking up one is colluding.

You might want to look up colluding.


Basically, rusi, I don't understand you. You seem to speak coherently,
but I never know what point you are making, what side you are arguing.
You seem to be strongly anti-Nikos, but further than that is opaque to
me. What I'm not too fond of, though, is your seeming insistence that
your methodology should be rigorously followed by every other party on
this list -- we are not a dictatorship, least of all one of your
control. As long as we all act civil, and occasionally on-topic, what
you do is at your discretion. Plus it's hard to follow someone's
command if you haven't the least idea what they're telling you to do.

Actually, the one other thing I get from you is that you have the
militant view of we have to all act now in unison to do whatever
your goal is, still not sure. It might explain your odd choice of
links.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Regular expression negative look-ahead

2013-07-01 Thread Ian Kelly
On Mon, Jul 1, 2013 at 8:27 PM, Jason Friedman jsf80...@gmail.com wrote:
 Found this:
 http://stackoverflow.com/questions/13871833/negative-lookahead-assertion-not-working-in-python.

 This pattern seems to work:
 pattern = re.compile(r^(?!.*(CTL|DEL|RUN)))

 But I am not sure why.


 On Mon, Jul 1, 2013 at 5:07 PM, Jason Friedman jsf80...@gmail.com wrote:

 I have table names in this form:
 MY_TABLE
 MY_TABLE_CTL
 MY_TABLE_DEL
 MY_TABLE_RUN
 YOUR_TABLE
 YOUR_TABLE_CTL
 YOUR_TABLE_DEL
 YOUR_TABLE_RUN

 I am trying to create a regular expression that will return true for only
 these tables:
 MY_TABLE
 YOUR_TABLE

 I tried these:
 pattern = re.compile(r_(?!(CTL|DEL|RUN)))
 pattern = re.compile(r\w+(?!(CTL|DEL|RUN)))
 pattern = re.compile(r(?!(CTL|DEL|RUN)$))

 But, both match.
 I do not need to capture anything.


For some reason I don't seem to have a copy of your initial post.

The reason that regex works is because you're anchoring it at the
start of the string and then telling it to match only if
.*(CTL|DEL|RUN) /doesn't/ match.  That pattern does match starting
from the beginning of the string, so the pattern as a whole does not
match.

The reason that the other three do not work is because the forward
assertions are not properly anchored.  The first one can match the
first underscore in MY_TABLE_CTL instead of the second, and then the
next three characters are TAB, not any of the verboten strings, so
it matches.  The second one matches any substring of MY_TABLE_CTL
that isn't followed by CTL.  So it will just match the entire string
MY_TABLE_CTL, and the rest of the string is then empty, so does not
match any of those three strings, so it too gets accepted.  The third
one simply matches an empty string that isn't followed by one of those
three, so it will just match at the very start of the string and see
that the next three characters meet the forward assertion.

Now, all that said, are you sure you actually need a regular
expression for this?  It seems to me that you're overcomplicating
things.  Since you don't need to capture anything, your need can be
met more simply with:

if not table_name.endswith(('_CTL', '_DEL', '_RUN')):
# Do whatever
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue18335] Add textwrap.dedent, .indent, as str methods.

2013-07-01 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue16468] argparse only supports iterable choices

2013-07-01 Thread paul j3

paul j3 added the comment:

chris.jerdonek wrote:
Also, to answer a previous question, the three places in which the choices 
string is used are: in the usage string (separator=','), in the help string 
when expanding %(choices)s (separator=', '), and in the error message text 
(separator=', ' with repr() instead of str()).

In the usage string, the ',' is used to make a compact representation of the 
choices.  The ', ' separator is used in the help line, where space isn't as 
tight.  

This 'choices formatting' is called during 'add_argument()' simply as a side 
effect of checking for valid parameters, especially 'nargs' (that it, is an 
integer or an acceptable string).  Previously 'nargs' errors were not caught 
until 'parse_args' was used.   This is discussed in

http://bugs.python.org/issue9849  Argparse needs better error handling for nargs

http://bugs.python.org/issue16970  argparse: bad nargs value raises misleading 
message 

On the issue of what error type to raise, my understanding is that 
'ArgumentError' is the preferred choice when it affects a particular argument.  
parse_args() nearly always raises an ArgumentError.  Once add_argument has 
created an action, it too can raise an ArgumentError.  ArgumentError provides a 
standard way of identifying which action is giving the problem.
  
While testing 'metavar=range(0,20)', I discovered that the usage formatter 
strips off parenthesis. A regex expression that removes 
excess 'mutually exclusive group' notation is responsible for this.  The simple 
fix is to modify the regex so it distinguishes between ' (...)' and 
'range(...)'.  I intend to create a new issue for this, since it affects any 
metavar the includes ().

--

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



[issue18336] codecs: Link to readline module (history) instead of fd.readline()

2013-07-01 Thread Thomas Guettler

New submission from Thomas Guettler:

The documentation of codecs.readline() has a link to the readline module.

That the same word with a total different meaning!

http://docs.python.org/2/library/codecs.html?highlight=readline#codecs.StreamReader.readline

The GNU readline module is about the history like bash or interactive python.

--
assignee: docs@python
components: Documentation
messages: 192111
nosy: docs@python, guettli
priority: normal
severity: normal
status: open
title: codecs: Link to readline module (history) instead of fd.readline()
versions: Python 2.7

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



[issue18337] codecs: StremReader readline() breaks on undocumented characters

2013-07-01 Thread Thomas Guettler

New submission from Thomas Guettler:

The stream reader of codecs.open() breaks on undocumented characters:

http://docs.python.org/2/library/codecs.html?highlight=codecs%20readline#codecs.StreamReader.readline

import tempfile
temp=tempfile.mktemp()
fd=open(temp, 'wb')
fd.write('abc\ndef\x85ghi')
fd.close()

import codecs
fd=codecs.open(temp, 'rb', 'latin1')
while True:
line=fd.readline()
if not line:
break
print repr(line)

Result:
u'abc\n'
u'def\x85'
u'ghi'

Related: 
http://stackoverflow.com/questions/16227114/utf-8-files-read-in-python-will-line-break-at-character-x85

--
assignee: docs@python
components: Documentation
messages: 192112
nosy: docs@python, guettli
priority: normal
severity: normal
status: open
title: codecs: StremReader readline() breaks on undocumented characters
versions: Python 2.7

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



[issue18334] type(name, bases, dict) does not call metaclass' __prepare__ attribute

2013-07-01 Thread Nick Coghlan

Nick Coghlan added the comment:

Unfortunately, it's not that simple, as calling type(name, bases, namespace) is 
*exactly* what a subclass will do as part of creating the type object.

From inside the type implementation, we can't tell the difference between 
properly called from the child type and improperly called without preparing 
the namespace first.

--

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



[issue18335] Add textwrap.dedent, .indent, as str methods.

2013-07-01 Thread Nick Coghlan

Nick Coghlan added the comment:

It turns out there's one slight wrinkle in this grand plan: it won't work for 
docstrings without some additional tweaking to allow for method calls in the 
docstring detection.

 def f():
... example.lower()
... 
 print(f.__doc__)
None
 import dis
 dis.dis(f)
  2   0 LOAD_CONST   1 ('example') 
  3 LOAD_ATTR0 (lower) 
  6 CALL_FUNCTION0 (0 positional, 0 keyword pair) 
  9 POP_TOP  
 10 LOAD_CONST   0 (None) 
 13 RETURN_VALUE

--

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



[issue18335] Add textwrap.dedent, .indent, as str methods.

2013-07-01 Thread Nick Coghlan

Nick Coghlan added the comment:

I still think the methods are worth adding regardless - I just anticipate a 
request to allow method calls on docstrings to follow not long after ;)

--

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



[issue18336] codecs: Link to readline module (history) instead of fd.readline()

2013-07-01 Thread Serhiy Storchaka

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


--
assignee: docs@python - serhiy.storchaka
keywords: +easy
nosy: +serhiy.storchaka
stage:  - needs patch
versions: +Python 3.3, Python 3.4

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



[issue18335] Add textwrap.dedent, .indent, as str methods.

2013-07-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

str already have too many methods. Who uses str.swapcase() or str.zfill() now? 
I'm -0.5 for adding any new str methods.

--
nosy: +serhiy.storchaka

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



[issue18337] codecs: StremReader readline() breaks on undocumented characters

2013-07-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report. This is a duplicate of issue18291.

--
nosy: +serhiy.storchaka
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - codecs.open interprets space as line ends
versions: +Python 3.3, Python 3.4

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



[issue18291] codecs.open interprets space as line ends

2013-07-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In contrary to documentation str.splitlines() splits lines not only on '\n', 
'\r\n' and '\r'.

 'a'.join(chr(i) for i in range(32)).splitlines(True)
['\x00a\x01a\x02a\x03a\x04a\x05a\x06a\x07a\x08a\ta\n', 'a\x0b', 'a\x0c', 'a\r', 
'a\x0ea\x0fa\x10a\x11a\x12a\x13a\x14a\x15a\x16a\x17a\x18a\x19a\x1aa\x1ba\x1c', 
'a\x1d', 'a\x1e', 'a\x1f']

--

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



  1   2   >