ANN: PyDDF Sprint 2014

2014-08-22 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group
 sprint in Düsseldorf, Germany]

ANKÜNDIGUNG

 PyDDF Sprint 2014

   27/28.09.2014

 Python Meeting Düsseldorf
http://pyddf.de/sprint2014/


INFORMATION

Das Python Meeting Düsseldorf (PyDDF) veranstaltet zusammen mit dem
ZIM der Heinrich-Heine-Universität Düsseldorf ein Python Sprint
Wochenende im September.

Der Sprint findet am Wochenende 27/28.09.2014 im Seminarraum
25.41.00.45 (Gebäude 25.41, Erdgeschoss, Raum 45) des ZIM der
HHU Düsseldorf stattfinden:

http://www.zim.hhu.de/das-zim/lageplan-und-anreiseskizze.html

Folgende Themengebiete haben wir als Anregung angedacht:

 * Openpyxl

   Openpyxl ist eine Python Bibliothek, mit der man Excel 2010
   XLSX/XLSM Dateien lesen und schreiben kann
   (https://pythonhosted.org/openpyxl/).

   Charlie ist Co-Maintainer des Pakets und würde gerne an
   folgenden Themen arbeiten:

 - ElementTree Implementation des lxml.etree.xmlfile Moduls
   (context manager)
 - Co-Routines für die Serialisierung
 - Python Code-Object-Generierung anhand des Schemas

 * HTTP Audio Streaming für Mopidy

   Mopidy ist ein MPD Musikserver, der viele Internet-Streaming-Dienste
   abonnieren kann, diese jedoch nur über lokale Audiogeräte ausgibt
   (http://docs.mopidy.com/en/latest/).

   Es wäre schön, wenn man auch Internetradios anschließen
   könnte, wie z.B. die Squeezebox. Es gibt dazu schon ein Ticket,
   auf dem man vermutlich aufbauen könnte:

- https://github.com/mopidy/mopidy/issues/56

   Ziel wäre es, eine Mopidy Extension zu schreiben, die dieses
   Feature umsetzt.

Natürlich kann jeder Teilnehmer weitere Themen vorschlagen, z.B.

 * Kivy
 * Raspberry Pi
 * FritzConnection
 * OpenCV
 * u.a.

Alles weitere und die Anmeldung findet Ihr auf der Sprint Seite:

http://pyddf.de/sprint2014/

Teilnehmer sollten sich zudem auf der PyDDF Liste anmelden, da wir
uns dort koordinieren:

https://www.egenix.com/mailman/listinfo/pyddf

Wir haben nur begrenzten Platz im Seminarraum, daher wäre es gut,
wenn wir die ungefähre Anzahl Teilnehmer schon in Vorfeld einplanen
könnten. Platz ist für max. 30 Teilnehmer.


ÜBER UNS

Das Python Meeting Düsseldorf (PyDDF) ist eine regelmäßige Veranstaltung
in Düsseldorf, die sich an Python Begeisterte aus der Region wendet:

 * http://pyddf.de/

Einen guten Überblick über die Vorträge bietet unser YouTube-Kanal,
auf dem wir die Vorträge nach den Meetings veröffentlichen:

 * http://www.youtube.com/pyddf/

Veranstaltet wird das Meeting von der eGenix.com GmbH, Langenfeld,
in Zusammenarbeit mit Clark Consulting  Research, Düsseldorf:

 * http://www.egenix.com/
 * http://www.clark-consulting.eu/

Mit freundlichen Grüßen,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 21 2014)
 Python Projects, Consulting and Support ...   http://www.egenix.com/
 mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2014-09-19: PyCon UK 2014, Coventry, UK ...29 days to go

: Try our mxODBC.Connect Python Database Interface for free ! ::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: Rainbowstream v0.8.1 Humanize datetime display

2014-08-22 Thread Minh Nhat
HI, I'm happy to announce that Rainbowstream v0.8.1 is released. 

v0.8.1 supports display humanize datetime for tweets, 
also fix some significant bugs. 
Detail information can be found at 
http://rainbowstream.readthedocs.org/en/latest/ 

Homepage: http://www.rainbowstream.org/ 
Github: https://github.com/DTVD/rainbowstream 
License: MIT 
Author: Vu Nhat Minh (@dtvd88) 
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Very basic question. How do I start again?

2014-08-22 Thread Tim Roberts
Seymore4Head Seymore4Head@Hotmail.invalid wrote:

I want to give the computer 100 tries to guess a random number between
1 and 100 picked by the computer.

If it takes more than 7, you're doing it wrong...
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread dieter
David Palao dpalao.pyt...@gmail.com writes:
  Why to use C++ instead of python?

Likely, you would not use Python to implement most parts of an
operating system (where, for efficiency reasons, some parts
are even implemented in an assembler language).

I can imagine that the GNU compiler developers, too, had good
reasons to implement them in C rather than a scripting language.
It makes a huge difference whether you wait one or several hours
before a large system is built.

firefox, too, seems to be implemented in C/C++. There, too, I
see good reasons:
  *  it is nice when your pages are rendered quickly

  *  firefox depends on lots of external libraries, all of them
 with C/C++ interfaces; while is is possible to create
 Python bindings for them, this is quite some work

  *  as it is, firefox is a huge memory eater; one might
 fear that things would be worse if implemented in a
 higher level language (with everything on the heap).
 Though, the fear might not be justified.


All these examples are really large projects. I like Python a lot
for smaller projects.

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


Re: Very basic question. How do I start again?

2014-08-22 Thread Igor Korot
Hi,

On Thu, Aug 21, 2014 at 10:56 PM, Tim Roberts t...@probo.com wrote:
 Seymore4Head Seymore4Head@Hotmail.invalid wrote:

I want to give the computer 100 tries to guess a random number between
1 and 100 picked by the computer.

 If it takes more than 7, you're doing it wrong...

I think he meant:
100 runs of the script...

Thank you.

 --
 Tim Roberts, t...@probo.com
 Providenza  Boekelheide, Inc.
 --
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what is the difference between name and _name?

2014-08-22 Thread luofeiyu

I fix a mistake in Steven D'Aprano interpretation.

class Person(object):
 def __init__(self, name):
 self._name = name
 def getName(self):
 print('fetch')
 return self._name
 def setName(self, value):
 print('change...')
 self._name = value
 def delName(self):
 print('remove')
 del self._name
 _name = property(getName, setName, delName, name property docs)


x=Person(peter)

It can not initinalize.
  File stdin, line 9, in setName
  File stdin, line 8, in setName
RuntimeError: maximum recursion depth exceeded while calling a Python 
object.


Steven D'Aprano interpretation:

10 Python finds the property _name
20 Python retrieves the getter, getName
30 Python runs the getName() method
40 which looks up self._name
50 go to 10

the right interpretation according to the error message:


10 python call __init__ method. self._name = name
20 python call setName method,
 print('change...')
 self._name = value
30 from self._name = value ,python call call setName method again

then we get a recursion error.

why i can not write  _name = property(getName, setName, delName, name
property docs) ?

Because you will have infinite recursion.

When you look up instance._name:

10 Python finds the property _name
20 Python retrieves the getter, getName
30 Python runs the getName() method
40 which looks up self._name
50 go to 10

and you get a recursion error.





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


Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Fri, Aug 22, 2014 at 4:12 PM, dieter die...@handshake.de wrote:
 Likely, you would not use Python to implement most parts of an
 operating system (where, for efficiency reasons, some parts
 are even implemented in an assembler language).

 I can imagine that the GNU compiler developers, too, had good
 reasons to implement them in C rather than a scripting language.
 It makes a huge difference whether you wait one or several hours
 before a large system is built.

 firefox, too, seems to be implemented in C/C++. There, too, I
 see good reasons:
   *  it is nice when your pages are rendered quickly

   *  firefox depends on lots of external libraries, all of them
  with C/C++ interfaces; while is is possible to create
  Python bindings for them, this is quite some work

   *  as it is, firefox is a huge memory eater; one might
  fear that things would be worse if implemented in a
  higher level language (with everything on the heap).
  Though, the fear might not be justified.


 All these examples are really large projects. I like Python a lot
 for smaller projects.

Yep. But it's not so much large vs small projects; these are all
situations where it's entirely plausible to saturate a CPU core for a
while, so the performance penalty of a high level language will
actually matter. (That said, though: Firefox has a lot of
non-performance-critical code, which AIUI is implemented in a higher
level language than C. And a long 'make' run probably involves some
shell scripting and such, not pure C code. Even high performance
projects have their less-critical parts.) Similarly, I'd be pretty
worried if someone rewrote X11 in Python. But if your program's going
to spend most of its time waiting (for the user, for the network, for
the real-time clock), halving its CPU usage won't materially affect
anything, and halving development time will make a huge difference.
That's when Python is an excellent choice.

At my last job, we had some parts written in Pike, some written in PHP
(not just the web site), and one back-end engine in C++. Toward the
end, I wanted to redo the C++ engine in Python or Pike, because I
didn't think the performance hit would be at all visible, and it would
have been much easier to work on. (I'd also been progressively taking
over jobs that PHP code had been doing and giving them to Pike
processes instead, with a not-so-secret goal of eventually ripping out
the PHP engine altogether. But that for other reasons.) As a back-end
process, its performance would be hard for the end user to see
directly, so the cost of a high level language would simply have been
that the server could cope with fewer requests per hour before we need
to requisition more hardware. Alas, there wasn't development time
available for the translation (we were far too busy doing things about
which I said YAGNI and the boss said Do it anyway), but I firmly
believe that we wouldn't have been suffering from the performance hit.

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


Re: Python vs C++

2014-08-22 Thread Stefan Behnel
dieter schrieb am 22.08.2014 um 08:12:
 David Palao writes:
  Why to use C++ instead of python?
 
 Likely, you would not use Python to implement most parts of an
 operating system (where, for efficiency reasons, some parts
 are even implemented in an assembler language).
 
 I can imagine that the GNU compiler developers, too, had good
 reasons to implement them in C rather than a scripting language.
 It makes a huge difference whether you wait one or several hours
 before a large system is built.
 
 firefox, too, seems to be implemented in C/C++. There, too, I
 see good reasons:
   *  it is nice when your pages are rendered quickly
 
   *  firefox depends on lots of external libraries, all of them
  with C/C++ interfaces; while is is possible to create
  Python bindings for them, this is quite some work
 
   *  as it is, firefox is a huge memory eater; one might
  fear that things would be worse if implemented in a
  higher level language (with everything on the heap).
  Though, the fear might not be justified.
 
 
 All these examples are really large projects. I like Python a lot
 for smaller projects.

While I agree that there are very valid reasons to write C/C++ code (and
operating systems clearly fall into that category), most of the above might
turn out to be fallacies. With a more high-level language, it is easier to
get a system running and then focus on optimisation than in a low-level
language that requires a lot of concentrated work just to get things done
at all. Especially in the long run, where the maintenance burden of
low-level code starts getting so much in the way that it becomes harder and
harder to keep improving the system and adding new features.

If, instead, you start with a high-level language, your first
implementation might not be as fast as your first C++ implementation could
have been, but it'll be almost certainly available much earlier, so that
you can then give it real world testing and performance evaluation. That
gives you a head start for optimisation and improvements, which then leads
to a faster system again. Thus, it's not unlikely that you already get an
even faster and better system (in terms of actual user experience) in the
same timeframe that you would otherwise have spent on getting even a first
working version of your system in a low-level language.

And the optimisation that you apply to your system may still include
rewriting parts of it in C++, but then really only those parts where real
world evaluation proved that it's worth the effort and maintenance overhead.

I've given a talk about this topic at PyCon-DE 2012. It's in German, but it
contains a lot of figures that should be understandable even if you don't
understand that language.

http://consulting.behnel.de/PyConDE/2012/ohnecpp.html

Stefan


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


when the method __get__ will be called?

2014-08-22 Thread luofeiyu

class C(object):
a = 'abc'
def __getattribute__(self, *args, **kwargs):
print(__getattribute__() is called)
return object.__getattribute__(self, *args, **kwargs)
def __getattr__(self, name):
print(__getattr__() is called )
return name +  from getattr
def __get__(self, instance, owner):
print(__get__() is called, instance, owner)
return self
def foo(self, x):
print(x)


 x=C()
 x.a
__getattribute__() is called
'abc'
 x.b
__getattribute__() is called
__getattr__() is called
'b from getattr'




If call an attribute which does exist ,__getattribute__() is called
If call an attribute which does not  exist ,__getattribute__() is called
and then __getattr__() is called ?

when the __get__ method will be called?no chance for my example?
--
https://mail.python.org/mailman/listinfo/python-list


Re: when the method __get__ will be called?

2014-08-22 Thread Peter Otten
luofeiyu wrote:

 class C(object):
  a = 'abc'
  def __getattribute__(self, *args, **kwargs):
  print(__getattribute__() is called)
  return object.__getattribute__(self, *args, **kwargs)
  def __getattr__(self, name):
  print(__getattr__() is called )
  return name +  from getattr
  def __get__(self, instance, owner):
  print(__get__() is called, instance, owner)
  return self
  def foo(self, x):
  print(x)
 
 
   x=C()
   x.a
 __getattribute__() is called
 'abc'
   x.b
 __getattribute__() is called
 __getattr__() is called
 'b from getattr'
 
 
 
 
 If call an attribute which does exist ,__getattribute__() is called
 If call an attribute which does not  exist ,__getattribute__() is called
 and then __getattr__() is called ?

You typically use either __getattribute__() which is called for every 
attribute or __getattr__() which is called only as a fallback when an 
attribute is not found in the instance __dict__.

 when the __get__ method will be called?no chance for my example?

__get__() is part of the descriptor protocol; it is called on attribute 
access:

 class A(object):
... c = C()
... 
 A().c
('__get__() is called', __main__.A object at 0x7f7cc2c8e850, class 
'__main__.A')
__main__.C object at 0x7f7cc2c8e910
 A.c
('__get__() is called', None, class '__main__.A')
__main__.C object at 0x7f7cc2c8e910


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


Re: when the method __get__ will be called?

2014-08-22 Thread Steven D'Aprano
Luofeiyu, you are asking very advanced questions. How experienced with
Python are you? Asking about __get__ is nearly never needed. __get__ is
used internally by built-ins like property, classmethod and staticmethod.
99.99% of Python programmers will never need to write a __get__ method, and
of the 0.01% who do, they might only write one or two in their whole
career.


luofeiyu wrote:

 class C(object):
  a = 'abc'
  def __getattribute__(self, *args, **kwargs):
  print(__getattribute__() is called)
  return object.__getattribute__(self, *args, **kwargs)
  def __getattr__(self, name):
  print(__getattr__() is called )
  return name +  from getattr
  def __get__(self, instance, owner):
  print(__get__() is called, instance, owner)
  return self
  def foo(self, x):
  print(x)


[...]
 If call an attribute which does exist ,__getattribute__() is called
 If call an attribute which does not  exist ,__getattribute__() is called
 and then __getattr__() is called ?

Correct.

 
 when the __get__ method will be called?no chance for my example?

No chance for your example. __get__ is used in the descriptor protocol,
used for methods and properties. You can see __get__ called here:


class D(object):
foo = C()

d = D()
d.foo


Now C.__get__ will be called.



-- 
Steven

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


Re: Python vs C++

2014-08-22 Thread Christian Gollwitzer

Am 21.08.14 14:54, schrieb David Palao:

I consider myself a python programmer, although C++ was one of the
first languages I learned (not really deeply and long time ago).

Now I decided to retake C++, to broaden my view of the business.
However, as I progress in learning C++, I cannot take out of my head
one question

  Why to use C++ instead of python?


You are asking in the wrong group; ask this in comp.lang.c++ Here most 
of the programmers know Python well and maybe some C++



It is not ranting against C++. I was/am looking for small-medium
projects to exercise my C++ skills. But I'm interested in a genuine
C++ project: some task where C++ is really THE language (and where
python is actually a bad ab initio choice).


The truth is, that both languages have a fairly large overlap. C++ spans 
a very wide gap, from tight low-level loops and direct memory access 
close to the metal up to composing a GUI application from ready-made 
building blocks. There is a variety of programming paradigmata, like 
functional (so-so), object oriented (quite good), generic (very good), 
imperative (shiny = the C subset). Graphically


C++:
metal |--|

Python:
metal ||


If your application lives within the overlap region, and a lot of them 
do, the choice is a matter of taste. I'm not even convinced that the 
development time is significantly lower in Python within this overlap. 
It becomes different at both ends: The more you go to the higher level, 
the more will Python outperform C++ in terms of development costs, but 
conversely C++ will win if you go closer to the metal. Then, as a Python 
programmer, you will find yourself rewriting parts of the application in 
Cython, trying PyPy, numpy, finally embedding C...


A few arguments outside of what I can do with it have already been given:

* For deployment, it is nice to compile and link a self-contained small 
binary. Try that with matplotlib - pyinstaller gets me a 100MB 
executable containing OS libraries, while the linker in C++ is able to 
only link what is needed.


* Access to the hardware: C structs, raw pointers, unboxed datatypes are 
needed in a painless and efficient way if you want to write, say,  a 
middle-level device driver


* performance is not only speed, but also memory usage. In most cases a 
C++ program will consume less memory


* static type checking can find bugs at compile-time. C++ is easier to 
compile (though on of the harder languages for compiler implementers), 
and therefore many tools exist for static analysis.



The usual argument in favour of C++ (when comparing to python) is
performance. But I'm convinced that, in general, the right approach is
python-profiling-(extension/numpy/Cython/...).


Well, that's Ousterhouts dichotomy.

Christian

Christian


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


Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Fri, Aug 22, 2014 at 6:05 PM, Christian Gollwitzer aurio...@gmx.de wrote:
 I'm not even convinced that the development time is significantly lower in
 Python within this overlap.

It usually will be, though not always.

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


Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com:

 On Fri, Aug 22, 2014 at 6:05 PM, Christian Gollwitzer aurio...@gmx.de wrote:
 I'm not even convinced that the development time is significantly
 lower in Python within this overlap.

 It usually will be, though not always.

Even more to the point, it is far easier to program correctly in Python
than C++. The higher-level concepts let you concentrate on the
high-level problem at hand instead of the low-level chores where you are
bound to make careless mistakes or take dangerous shortcuts.

So my advise is, use as high-level programming language as you can. If
you can't, deal with it, but often you can break your system into parts
where only a small corner needs to be implemented at the low level.

Remember, too, that there is a whole sliding scale of programming
languages:

   assembly
   C
  C++
  Go
 Java/C#
 Python
 Scheme
 Bash

In my current work, the choice is between C, Python and Bash. Some
non-STL C++ in the mix.

In my previous job, it was Java, Python and Bash, with some JNI in the
mix.

I think Python's abstraction level is excellent for most needs. C++ is
squeezed from all sides. Its downfall is that it is trying to cover
everything instead of just ceding the high-level turf to other
languages. Thus, it is too elaborate for the nimble stuff, and you will
often simply use C where you need nimble.

C is readily supported by all extension APIs. Its calling conventions
are stable and well-understood. Its runtime requirements are trivial.
Plus, you don't have to be a Medieval Scholar to program in it.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing Problems - 'Key not valid for use in specified state.'

2014-08-22 Thread FreddieH
I am having trouble installing Python on my Windows 7 (x64) Laptop.
The MSI file for Python 3.4.1 that I have downloaded got to the set up page 
containing 'Please wait while the Installer installs Python 3.4.1' and asks for 
administrator permission to continue the installation.
After I give administrator permission to continue with the install, it gives me 
the error pop up 'Key not valid for use in specified state.'
After some googling I can see that this is a problem with some installer 
packages but I have not yet found a solution to this problem. In addition to 
the googling, I talked to the people on the Windows IRC channel at freenode 
[webchat.freenode.net/?channels=windows] but they too were unable to find a 
problem . They said that the installer package was corrupted and that I should 
contact support.
I have also tried using other versions python installers but they return the 
same error.

Thank you for your time,
Freddie Horton
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Neil D. Cerutti

On 8/22/2014 5:29 AM, Marko Rauhamaa wrote:

C is readily supported by all extension APIs. Its calling conventions
are stable and well-understood. Its runtime requirements are trivial.
Plus, you don't have to be a Medieval Scholar to program in it.


C itself is very simple (albeit not simple to use). But I contend you do 
need to be a Medieval Scholar to compile and link it. My mind boggles 
watching a ./configure vomit ASCII all over my screen. I have to avert 
my eyes, make a wish, and make install. ;)


--
Neil Cerutti

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


Re: Python vs C++

2014-08-22 Thread Skip Montanaro
On Fri, Aug 22, 2014 at 7:51 AM, Neil D. Cerutti ne...@norwich.edu wrote:

 But I contend you do need to be a Medieval Scholar to compile and link it.


That's only because whoever wrote your Makefile wasn't skilled in the art
of make recipes. :-)

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


Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Fri, Aug 22, 2014 at 10:51 PM, Neil D. Cerutti ne...@norwich.edu wrote:
 C itself is very simple (albeit not simple to use). But I contend you do
 need to be a Medieval Scholar to compile and link it. My mind boggles
 watching a ./configure vomit ASCII all over my screen. I have to avert my
 eyes, make a wish, and make install. ;)

Bah, it's more fun to actually read it, and to imagine what manner of
system might fail some of those tests :)

checking for candle... no
checking whether the C compiler works... yes
checking for stdlib.h... yes
checking for windows.h usability... no
checking for windows.h presence... no
(these last two on a system that had already been probed and found to be Linux)

And of course:
checking whether build environment is sane...
http://xkcd.com/371/

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


Why can not initialize the class?

2014-08-22 Thread luofeiyu

System:win7+python34.

class Contact(object):
def __init__(self, first_name=None, last_name=None,
 display_name=None, email=None):
self.first_name = first_name
self.last_name = last_name
self.display_name = display_name
self.email = email
def print_info(self):
print(self.display_name,  + self.email +   )
def set_email(self, value):
if '@' not in value:
raise Exception(This doesn't look like an email address.)
self._email = value
def get_email(self):
return self._email
email = property(get_email, set_email)

contact = Contact()

The error message is :
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 7, in __init__
  File stdin, line 11, in set_email
TypeError: argument of type 'NoneType' is not iterable

What is wrong with the code?
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:26 AM, luofeiyu elearn2...@gmail.com wrote:
 System:win7+python34.

 class Contact(object):
 def __init__(self, first_name=None, last_name=None,
  display_name=None, email=None):
 self.first_name = first_name
 self.last_name = last_name
 self.display_name = display_name
 self.email = email
 def print_info(self):
 print(self.display_name,  + self.email +   )
 def set_email(self, value):
 if '@' not in value:
 raise Exception(This doesn't look like an email address.)
 self._email = value
 def get_email(self):
 return self._email
 email = property(get_email, set_email)

 contact = Contact()

 The error message is :
 Traceback (most recent call last):
   File stdin, line 1, in module
   File stdin, line 7, in __init__
   File stdin, line 11, in set_email
 TypeError: argument of type 'NoneType' is not iterable

 What is wrong with the code?

The 'in' operator requires an iterable. When you do 'self.email =
email' set_email gets called and value is None.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu

how to fix the code then?
On 8/22/2014 10:36 PM, Larry Martell wrote:
The 'in' operator requires an iterable. When you do 'self.email = 
email' set_email gets called and value is None. 


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


Re: Why can not initialize the class?

2014-08-22 Thread Joel Goldstick
On Fri, Aug 22, 2014 at 10:42 AM, luofeiyu elearn2...@gmail.com wrote:
 how to fix the code then?

 On 8/22/2014 10:36 PM, Larry Martell wrote:

 The 'in' operator requires an iterable. When you do 'self.email = email'
 set_email gets called and value is None.


You might want to set your default values to  instead of none.  When
you create an instance of Contact, you should pass the first name,
last name, and email address.
 --
 https://mail.python.org/mailman/listinfo/python-list



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


Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/21/2014 06:54 AM, David Palao wrote:
 Hello,
 I consider myself a python programmer, although C++ was one of the
 first languages I learned (not really deeply and long time ago).
 
 Now I decided to retake C++, to broaden my view of the business.
 However, as I progress in learning C++, I cannot take out of my head
 one question
 
  Why to use C++ instead of python?

Get yourself a cheap arduino-compatible board  ($20 or so) and then
start programming it.  The Arduino framework is C++.  It's kind of fun
to program in such a small, compact environment.  C++ actually suits it
fairly well.

What I sometimes do is mock up an arduino project on the PC using python
(talking directly to arduino I/O pins using a special firmware that
talks over the serial port), and then convert it to C++ to run directly
on the arduino.

Another project combines arduino with a raspberry pi or like device.
C++ code runs on the arduino, and Python runs on the pi to communicate
with it and do things like provide a web interface.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installing Problems - 'Key not valid for use in specified state.'

2014-08-22 Thread Michael Torrie
On 08/22/2014 05:51 AM, FreddieH wrote:
 I am having trouble installing Python on my Windows 7 (x64) Laptop.
 The MSI file for Python 3.4.1 that I have downloaded got to the set up page 
 containing 'Please wait while the Installer installs Python 3.4.1' and asks 
 for administrator permission to continue the installation.
 After I give administrator permission to continue with the install, it gives 
 me the error pop up 'Key not valid for use in specified state.'
 After some googling I can see that this is a problem with some installer 
 packages but I have not yet found a solution to this problem. In addition to 
 the googling, I talked to the people on the Windows IRC channel at freenode 
 [webchat.freenode.net/?channels=windows] but they too were unable to find a 
 problem . They said that the installer package was corrupted and that I 
 should contact support.
 I have also tried using other versions python installers but they return the 
 same error.

The problem isn't with the installer, but with Windows.  A quick google
search reveals that deleting (rename for backup purposes) the following
directory should help:

C:\Users\xxx\AppData\Roaming\Microsoft\Crypto\RSA

I usually would rename it to something like RSA.corrupted.  Then after
things were working again, I'd delete it.

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


Re: Why can not initialize the class?

2014-08-22 Thread Larry Martell
On Fri, Aug 22, 2014 at 10:58 AM, luofeiyu elearn2...@gmail.com wrote:
 class Contact(object):
 ... def __init__(self, first_name=None, last_name=None,
 ...  display_name=None, email=haha@haha):
 ... self.first_name = first_name
 ... self.last_name = last_name
 ... self.display_name = display_name
 ... self.email = email
 ... def print_info(self):
 ... print(self.display_name,  + self.email +   )
 ... def set_email(self, value):
 ... print(value)
 ... self._email = value
 ... def get_email(self):
 ... return self._email
 ... email = property(get_email, set_email)
 ...

 contact = Contact()
 haha@haha

 why the value in `def set_email(self, value): `  is  haha@haha?
 how haha@haha  is called to  value in `def set_email(self, value): `?
 would you mind telling me the process?

https://docs.python.org/3.4/library/functions.html#property
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu

 class Contact(object):
... def __init__(self, first_name=None, last_name=None,
...  display_name=None, email=haha@haha):
... self.first_name = first_name
... self.last_name = last_name
... self.display_name = display_name
... self.email = email
... def print_info(self):
... print(self.display_name,  + self.email +   )
... def set_email(self, value):
... print(value)
... self._email = value
... def get_email(self):
... return self._email
... email = property(get_email, set_email)
...

 contact = Contact()
haha@haha

why the value in `def set_email(self, value): `  is  haha@haha?
how haha@haha  is called to  value in `def set_email(self, value): `?
would you mind telling me the process?






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


Re: Why can not initialize the class?

2014-08-22 Thread Steven D'Aprano
Luofeiyu, you are getting stuck on basic questions. Before working with
advanced features like properties, you should learn the simply features.


luofeiyu wrote:

  class Contact(object):
 ... def __init__(self, first_name=None, last_name=None,
 ...  display_name=None, email=haha@haha):
 ... self.first_name = first_name
 ... self.last_name = last_name
 ... self.display_name = display_name
 ... self.email = email
 ... def print_info(self):
 ... print(self.display_name,  + self.email +   )
 ... def set_email(self, value):
 ... print(value)
 ... self._email = value
 ... def get_email(self):
 ... return self._email
 ... email = property(get_email, set_email)
 ...
  
   contact = Contact()
 haha@haha
 
 why the value in `def set_email(self, value): `  is  haha@haha?
 how haha@haha  is called to  value in `def set_email(self, value): `?
 would you mind telling me the process?

Instead of this complicated example, start with this simple example:

class Contact(object):
def __init__(self, email=haha@haha):
self.email = email

contact = Contact()
print(contact.email)


Do you understand how contact.email gets set to haha@haha?


Now let's make it a bit more complicated:

class Contact(object):
def __init__(self, email=haha@haha):
self.set_email(email)
def set_email(self, value):
self.email = value

contact = Contact()
print(contact.email)


Do you still understand how contact.email gets set to haha@haha?


One final version:

class Contact(object):
def __init__(self, email=haha@haha):
self.email = email
def _get_email(self):
return self._the_secret_private_email
def _set_email(self, value):
self.self._the_secret_private_email = value
email = property(_get_email, _set_email)

contact = Contact()
print(contact.email)


Now do you understand how contact.email gets set to haha@haha?



-- 
Steven

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


Som confusion about the python library installation

2014-08-22 Thread Jiafan Zhou
Hi all,

Need some explanation on my already done python library installation.

I was informed to work on a python project which requires a number of python 
libraries.

One of them is the python-nose unit testing framework

Since I am in Ubuntu 12.04 lts, the first thing I did was to issue the below 
command:

sudo apt-get install python-nose

One the installation completes, the version of python-nose it installed is 1.1.2

$ dpkg -l | grep -i nose
ii  python-nose  1.1.2-3

And it is available in the python library and can be viewed from the pip

Later on, I realized the target version I should use is nose 1.3.3

So in the pip, I performed:

pip install --upgrade nose

Now from the pip, it is nose(1.3.3), whereas the apt-get still reports 
python-nose (1.1.2-3)

I guess it must be the 1.3.3 version being used in the system, but why apt-get 
still reports 1.1.2-3 and this worries me a little.

Another separate question in relation, do I really need to install the 
python-nose in ubuntu. Can I not just go directly to pip and install the nose 
library?

Regards,
Jiafan
-- 
https://mail.python.org/mailman/listinfo/python-list


error building lxml.etree

2014-08-22 Thread Robin Becker
I'm trying to build a bunch of extensions in a 2.7 virtual environment on a 
centos 7 VM. I don't know centos very well and I understand centos 7 is quite new



building 'lxml.etree' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

creating build/temp.linux-x86_64-2.7/src/lxml

gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 
-grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG 
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector-strong --param=ssp-buffer-size=4   -grecord-gcc-switches 
-m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2 
-I/home/rptlab/website/xxx/xxx_0/build/lxml/src/lxml/includes 
-I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o 
build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

{standard input}: Assembler messages:

{standard input}:1858223: Error: unknown pseudo-op: `.'

gcc: internal compiler error: Killed (program cc1)

Please submit a full bug report,

with preprocessed source if appropriate.

See http://bugzilla.redhat.com/bugzilla for instructions.

error: command 'gcc' failed with exit status 4



uname -a

Linux localhost.localdomain 3.10.0-123.6.3.el7.x86_64 #1 SMP Wed Aug 6 21:12:36 
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux





gcc --version

gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I do have the various devel rpms installed so far as I can tell.

Has anyone else seen this error? It's entirely possible that it might be I don't 
have enough memory or something, lxml builds almost always take a long time.

--
Robin Becker

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


Re: Som confusion about the python library installation

2014-08-22 Thread Michael Torrie
On 08/22/2014 09:46 AM, Jiafan Zhou wrote:
 I guess it must be the 1.3.3 version being used in the system, but
 why apt-get still reports 1.1.2-3 and this worries me a little.
 
 Another separate question in relation, do I really need to install
 the python-nose in ubuntu. Can I not just go directly to pip and
 install the nose library?

This is what happens when you mix installing from operating system
packages with installing from other methods (pip, tar.gz, etc).  The
package system is not notified when you install from other sources, so
it still thinks the package is original.  Now with pip you've
overwritten (most likely) the version of nose.  This should be okay,
though if another update to nose comes through Ubuntu, it will overwrite
your pip version.

Just be careful what you manually install over top of a built-in
package.  For example you should never overwrite the packaged version of
Python itself, for example.  If you need to install a new version of
Python, it must be installed along side the system version, in a
different directory.  Sometimes you can find newer versions of software
that you can install with Ubuntu's package tools.  For example, some
people provide PPAs you can use to integrate newer software easily.

Ubuntu 12.04 is rather old now, and while it's still supported, it does
not have the newer versions of some software that you might require, as
you noticed with python-nose.  You could try Ubuntu 14.04.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Joseph Martinot-Lagarde

Le 22/08/2014 02:26, Chris Angelico a écrit :

On Fri, Aug 22, 2014 at 4:05 AM, Joseph Martinot-Lagarde
joseph.martinot-laga...@m4x.org wrote:

For information, Cython works with C++ now:
http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html.


Now isn't that cool!

Every time Cython gets discussed, I get a renewed desire to learn it.
Trouble is, I don't have any project that calls for it - there's
nothing I'm desperately wanting to do that involves both Python and
C/C++. Anyone got any suggestions? :)

ChrisA


A python API for OpenSceneGraph ? I wouldn't use cython for this, though...

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


Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa
Skip Montanaro s...@pobox.com:

 On Fri, Aug 22, 2014 at 7:51 AM, Neil D. Cerutti ne...@norwich.edu wrote:
 But I contend you do need to be a Medieval Scholar to compile and link it.

 That's only because whoever wrote your Makefile wasn't skilled in the
 art of make recipes. :-)

Make shouldn't be involved in any serious work. It was designed for the
case where you have a handful of source files in a single directory. Its
use has gotten completely out of hand.

I sincerely recommend SCons for anything more serious. A word of
warning, though: SCons gives you the power of Python. Don't use that
power except in utmost need.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: error building lxml.etree

2014-08-22 Thread Stefan Behnel
Robin Becker schrieb am 22.08.2014 um 17:50:
 I'm trying to build a bunch of extensions in a 2.7 virtual environment on a
 centos 7 VM. I don't know centos very well and I understand centos 7 is
 quite new
 
 building 'lxml.etree' extension

 creating build/temp.linux-x86_64-2.7

 creating build/temp.linux-x86_64-2.7/src

 creating build/temp.linux-x86_64-2.7/src/lxml

 gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
 --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
 -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall
 -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
 --param=ssp-buffer-size=4   -grecord-gcc-switches -m64 -mtune=generic
 -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/libxml2
 -I/home/rptlab/website/xxx/xxx_0/build/lxml/src/lxml/includes
 -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o
 build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w

 {standard input}: Assembler messages:

 {standard input}:1858223: Error: unknown pseudo-op: `.'

 gcc: internal compiler error: Killed (program cc1)

 Please submit a full bug report,

 with preprocessed source if appropriate.

 See http://bugzilla.redhat.com/bugzilla for instructions.

 error: command 'gcc' failed with exit status 4
 
 
 uname -a
 Linux localhost.localdomain 3.10.0-123.6.3.el7.x86_64 #1 SMP Wed Aug 6
 21:12:36 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
 
 
 gcc --version
 gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16)
 Copyright (C) 2013 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 I do have the various devel rpms installed so far as I can tell.
 
 Has anyone else seen this error? It's entirely possible that it might be I
 don't have enough memory or something

Yes, that's most likely it. Having 500MB+ of free(!) RAM is a good idea for
the build.


 lxml builds almost always take a long time.

For testing, you can speed things up quite substantially by using -O0 as
your CFLAGS. Not a good idea for a production system, though.

You might also get away with building a (static?) wheel on another
compatible Linux system that has more RAM.

Stefan


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


Global indent

2014-08-22 Thread Seymore4Head
Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?

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


Re: Global indent

2014-08-22 Thread Skip Montanaro
On Fri, Aug 22, 2014 at 1:19 PM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
 Say I have a while statement with several lines of code and I want to
 add a while outside that.  That means indenting everything.  Is there
 a global way to do that?

Depends on your text editor/IDE. In Emacs using either python-mode.el
or python.el, I use C-c  to shift the selected region right, C-c  to
shift it left. Other editors probably have similar commands.

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


Re: Global indent

2014-08-22 Thread Neil D. Cerutti

On 8/22/2014 2:19 PM, Seymore4Head wrote:

Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?


This sort of simple task is why fancy text editors were invented.

I use and recommend gvim (press  in select mode using the standard 
python plugin), but there are plenty of options out there.


--
Neil Cerutti




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


Re: Python vs C++

2014-08-22 Thread CHIN Dihedral
On Friday, August 22, 2014 8:26:00 AM UTC+8, Chris Angelico wrote:
 On Fri, Aug 22, 2014 at 4:05 AM, Joseph Martinot-Lagarde
 
 joseph.martinot-laga...@m4x.org wrote:
 
  For information, Cython works with C++ now:
 
  http://docs.cython.org/src/userguide/wrapping_CPlusPlus.html.
 
 
 
 Now isn't that cool!
 
 
 
 Every time Cython gets discussed, I get a renewed desire to learn it.
 
 Trouble is, I don't have any project that calls for it - there's
 
 nothing I'm desperately wanting to do that involves both Python and
 
 C/C++. Anyone got any suggestions? :)
 
 
 
 ChrisA

Don't you use C as a portable assembler
in Python?

PYTHON-C-HW_BOUNDED_ASSEMBLY

That is the way to speed up python
programs using critical heavy 
computing functions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Global indent

2014-08-22 Thread Dan Stromberg
On Fri, Aug 22, 2014 at 11:44 AM, Neil D. Cerutti ne...@norwich.edu wrote:
 On 8/22/2014 2:19 PM, Seymore4Head wrote:

 Is there a way to indent everything again?

 Say I have a while statement with several lines of code and I want to
 add a while outside that.  That means indenting everything.  Is there
 a global way to do that?


 This sort of simple task is why fancy text editors were invented.

 I use and recommend gvim (press  in select mode using the standard python
 plugin), but there are plenty of options out there.

Here's another way of saying it (for vi or vim or other vi clone):
1) Go to the top of the region you want to indent.
2) Type ma in command mode to set a mark named a.
3) Go to the bottom of the region you want to indent.
4) Type 'a to indent, one level, everything between the mark named
a and the cursor

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


Halfway point between interactive and daemon?

2014-08-22 Thread Travis Griggs
I have a python3 program that performs a long running service on a semi 
embedded linux device. I've been in the prototyping stage.  I just run it from 
the command line and use print() statements to let me know the thing is making 
acceptable process.

At some point, I need to properly daemonize it. Write an init script, find a 
logging framework/module, batton all the hatches down, so to speak.

I’m curious if there’s a technique one could use to get half way there. 
Basically, with minimal modifications, I’d like to get it running at startup. 
So I can put a line like this in rc.local

nohup python3 myMain.py 21  /var/log/mylog.log 

Then I can “check” on it when I need to with a tail -f /var/log/mylog.log. But 
then I have the problem of managing the log size. And also I either have to 
wait for stdout to flush, or insert sys.stdout.flush() after any of my 
print()’s.

I haven’t done a lot of these daemon processes (and this is my first with 
python), so I was curious what those with experience do here.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Christian Gollwitzer

Am 22.08.14 11:29, schrieb Marko Rauhamaa:

So my advise is, use as high-level programming language as you can. If
you can't, deal with it, but often you can break your system into parts
where only a small corner needs to be implemented at the low level.


Agreed. This is called Ousterhout's dichotomy.


Remember, too, that there is a whole sliding scale of programming
languages:

assembly
C
   C++
   Go
  Java/C#
  Python
  Scheme
  Bash



My point is that this picture is incomplete: it shows the programming 
languages as *points* on the complexity line, whereas they are rather 
*intervals*. And these intervals have large overlaps.


My picture:
as |--|
c   ||
c++   |---|
java |-|
python||


 * Assembly is really narrow: tiny loops, compiler output snippets, 
firmware for really small embedded devices - anything beyond should be 
written in higher languages.


* C has a much broader scope: you can do most of the tiny loops and 
firmware stuff, unless the device is too small or you are bootstrapping 
a kernel. But it also scales up until command line tools such as sort 
and even can do moderately complex programs like the CPython interpreter 
- even if that would be much easier to write in C++. I guess the only 
reason for CPython instead of C++Python is the better portability of C.


* C++ embraces all of C, and by that definition reaches from the low end 
up to GUI applications  - most modern everyday programs are written in 
C++ in large parts. At the low end, it looses some device driver stuff, 
because exceptions, RTTI and such features are incompatible with code 
running in the kernel of an OS. But it still can make good use of memory 
(class and struct have the same memory layout). On the high end, you can 
write programs managing high-level data structures without a single 
explicit pointer or new and delete in your code.


* Java: I don't see that it is much higher level than C++. It has a GC, 
but that's all, and you can have that in C++, too, if you want. On the 
other hand, you loose the metaprogramming facilities provided by C++ 
templates (needs a guru to make a library, but can be handy and easy to 
use, e.g. everything in Boost). You loose direct memory access, gaining 
what? no idea.


* Python: On the low end almost on par with Java, slower because of 
dynamic typing, no direct memory access. On the high end manages complex 
libraries with single few invocations, good support for functional-style 
programming (generators, list comprehensions), the first in this list 
with an acceptable REPL in the standard distribution - imagine assembly, 
C++ or even Java with a REPL


Scheme - only played with it some time ago, seems to me like the 
assembly of functional languages. Compare that to Haskell, which is an 
elaborate high-level language. I wouldn't claim that it is higher-level 
than Python.



I think Python's abstraction level is excellent for most needs. C++ is
squeezed from all sides. Its downfall is that it is trying to cover
everything instead of just ceding the high-level turf to other
languages. Thus, it is too elaborate for the nimble stuff, and you will
often simply use C where you need nimble.


Ousterhout's dichotomy. It's a good paradigm in many cases, but 
sometimes it might be preferable to have everything in a single 
language. And this is a good domain for C++.



C is readily supported by all extension APIs. Its calling conventions
are stable and well-understood. Its runtime requirements are trivial.
Plus, you don't have to be a Medieval Scholar to program in it.


I'm currently implementing a numpy-like library for another language in 
C. I choosed C for the ABI/portability reason, but I am really missing 
C++ in many, many places. The code is an awful mess of macros to get 
simple metaprogramming facilities, i.e. to support different data types 
and operations. This is a domain where C++ would be the best choice, and 
only the stupid reason of possible runtime dependency guided the 
decision to use C.


Everything which needs string processing, but still has to run fast, is 
another good candidate. Compilers are certainly less painful to write in 
C++ than in C, and could still run with native speed. For sure it is 
much easier to do a compiler in Python, but this will come with a speed 
penalty (of the compilation, not the code, as evidenced by PyPy).


Christian

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


Re: Halfway point between interactive and daemon?

2014-08-22 Thread Marko Rauhamaa
Travis Griggs travisgri...@gmail.com:

 nohup python3 myMain.py 21  /var/log/mylog.log 

I don't recommend this (ubiquitous) technique. You should keep your
daemon in the foreground until it has reserved and initialized all the
resources it needs and daemonize only then. That way the caller does not
have to guess when the service is really available.

The proper daemonization procedure is here:

  URL: http://code.activestate.com/recipes/66012-fork-a-dae
  mon-process-on-unix/

Now, with the new systemd standard, there is a way for you to inform the
system when a service is up even after backgrounding. I have no personal
experience with that technique.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Global indent

2014-08-22 Thread Seymore4Head
On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:

Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?

Ok.so the answer is no using IDLE (Python GUI)

The top two answers so far are Emacs and gvim.

http://gvim.en.softonic.com/  Has a snazzy look, but I think it is not
compatible with Windows so it looks like I might have to try Emacs.

Thanks everyone
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Global indent

2014-08-22 Thread Rob Gaddi
On Fri, 22 Aug 2014 15:46:33 -0400
Seymore4Head Seymore4Head@Hotmail.invalid wrote:

 On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head
 Seymore4Head@Hotmail.invalid wrote:
 
 Is there a way to indent everything again?
 
 Say I have a while statement with several lines of code and I want to
 add a while outside that.  That means indenting everything.  Is there
 a global way to do that?
 
 Ok.so the answer is no using IDLE (Python GUI)
 
 The top two answers so far are Emacs and gvim.
 
 http://gvim.en.softonic.com/  Has a snazzy look, but I think it is not
 compatible with Windows so it looks like I might have to try Emacs.
 
 Thanks everyone

Emacs and vim both have huge learning curves that I've decided aren't
worth climbing.  Notepad++ is an excellent GUI text editor for Windows.
Geany is nearly as good, and runs on anything.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Stefan Behnel
If you want to add Cython to that (overly simplified) graph, you might get
something like this:

Christian Gollwitzer schrieb am 22.08.2014 um 21:25:
 as |--|
 c   ||
 c++   |---|
Cython   ||
 python||

Meaning, there is a lot you can do in Cython that can keep you from having
to write C/C++ code at all. And even if you really have to, it still helps
in keeping that down to a couple of well chosen snippets rather than full
programs.

Stefan


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


Re: Global indent

2014-08-22 Thread Simon Ward


On 22 August 2014 19:44:39 BST, Neil D. Cerutti ne...@norwich.edu wrote:

This sort of simple task [indenting blocks of text] is why fancy text editors 
were invented.

I use and recommend gvim (press  in select mode using the standard 
python plugin), but there are plenty of options out there.

Even without the Python add-on this should work. It shifts the text based on 
the 'shiftwidth' setting.

I vaguely remember using some other editors (one or more of Nedit, Gedit, Kate, 
Notepad++, Eclipse) that use, or can be configured to use, the tab key to 
indent selected text rather than replacing it with a tab character. Shift-tab 
probably out dented too.

Simon
-- 
Sent from Kaiten Mail. Please excuse my brevity.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Travis Griggs

On Aug 21, 2014, at 12:55 AM, icefap...@gmail.com wrote:

 Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic 
 (in a we-are-all-grown-ups fashion, ahem)enough to get its way into the 
 language
 this is what yours truly thinks: don't we all know that : means the next 
 token must be an indent (mostly)? and doesn't the ( and its alikes, [ and } 
 begin an space-insensitive lexing context? so all we need is having an 
 space-sensitivity-stack and the corresponding ( counting stack and this 
 way we could match opening and closing () and pop the 
 space-sensitivity-stack whenever the ( counting stack gets a 0 at the top:
snip

Those more pythonista than me have weighed in on the particulars. I’ll offer 
some more general thoughts.

While I dwell in the land of pythonistas, I’m a an expat from the Island of 
Smalltalk. I live happily in Pythonville and will probably never return to the 
shrinking island, I do miss Smalltalk’s block closures. I don’t miss them *too* 
much, because things like comprehensions as well as the large library of 
functional like modules, covers many of the use cases. But I do miss their 
simple elegance.

I do not like the python lambda. For two reasons.

One: In a language that sought to be approachable by simple people (i.e. non 
computer science graduates who would use it in addition to their 
scientific/education background), I can’t believe they threw in a 6 character  
phonetic description of a greek character to imply “fragment of code expression 
to be executed in a removed context”. Show a subset of keyword.kwlist to a 
non-comp-sci guy and tell me if when they see the ‘lambda’ betwixt the others, 
they don’t stop and think “huh, one of these is not like the others”.

Two: The reason that this subject circles regularity, because they used a 
keyword, it can only be used as a literal creator for a single line expression. 
So we keep coming back to “how can we do multiple expressions with a 
lambda/closure”.

For the unaware, the Smaltalk syntax for a literal block closure was a pair of 
[ ]. First of all, I liked that the characters actually looked like a “block” 
with the corners. I liked that it did not use parentheses. Parentheses are 
pretty loaded already, and it helped the brain pick out the differences 
instantly. I don’t like the OP’s proposal because I don’t think (def()) is 
distinct from normal grouping () statements. And I liked how terse they are. 
Two characters and you had a block. They are *everywhere* in the library. 
Compare that with how often you find ‘lambda’ in the python standard modules. I 
used to joke about the irony, that no language did more with functional 
closures than the all-objects-all-the-time Smalltalk, and that CLOS had a more 
robust object model than Smalltalk.

To me, for a multiple-expression (multi line or not) literal closure syntax to 
succeed, it must a) denote both the start and stop (not a leading keyword), b) 
be extremely terse so that the cost of creating closures is reduced c) not be 
confused with other common literal denotation so it can be quickly recognized 
when reading close (so [ and { are out for example, because of lists and 
dictionaries, and using   would cause complete confusion because it’s hard at 
a glance to differentiate from a comparison operand).

Personally, I don’t think the desire to use lines as statement boundaries 
(something I like a lot) and at the same time to tersely pack multiple 
statements into a deferred code fragment, are reconcilable. And I don’t think 
there’s critical mass desire for them. So this subject will continue to 
resurface regularly. But I thought I’d chime in with a “foreigners” perspective.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Marko Rauhamaa

 assembly
 C
C++
Go
   Java/C#
   Python
   Scheme
   Bash


 My point is that this picture is incomplete: it shows the programming
 languages as *points* on the complexity line,

I don't see any points. I see words.

 whereas they are rather *intervals*. And these intervals have large
 overlaps.

Add line segments as wide as you'd like.

 Ousterhout's dichotomy. It's a good paradigm in many cases, but
 sometimes it might be preferable to have everything in a single
 language. And this is a good domain for C++.

I tend to think the opposite: C++ barely has a niche left. I definitely
wouldn't want to use C++ very far from its (very narrow) sweet spot.

 I'm currently implementing a numpy-like library for another language
 in C. I choosed C for the ABI/portability reason, but I am really
 missing C++ in many, many places. The code is an awful mess of macros
 to get simple metaprogramming facilities, i.e. to support different
 data types and operations. This is a domain where C++ would be the
 best choice, and only the stupid reason of possible runtime dependency
 guided the decision to use C.

C++'s gift to programming was to take static typing to its utmost
limits -- to the detriment of usability, learnability and
intelligibility. STL and Boost have been turned into totems that
supposedly turn a dire necessity into a virtue.

C's give to programming is the void pointer. It's the antithesis of C++,
but damn does it get you out of every bind -- no fuss, no semantic
handwringing.

My disillusionment with C++ came from the language's inability to
represent callbacks. C can do it (void *), C# can do it (delegates),
Java can do it (anonymous inner classes), Python can do it (methods),
Scheme can do it (closures).

Qt needs callbacks (signals IIRC). It doesn't use C++ to express them.
It uses a fricking metacompiler for them.

And Stroustrup's thick book didn't even seem to be aware of callbacks as
a paradigm and thus didn't show any examples of dealing with them. Too
bad Stroustrup wasn't aware of C#'s delegates; C++ should have defined
function pointers as delegates.

 Everything which needs string processing, but still has to run fast,
 is another good candidate. Compilers are certainly less painful to
 write in C++ than in C, and could still run with native speed. For
 sure it is much easier to do a compiler in Python, but this will come
 with a speed penalty (of the compilation, not the code, as evidenced
 by PyPy).

There is one big advantage C++ has over C: virtual method dispatching.
However, I have been able to come up with C idioms that make practical
method dispatching relatively painless.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Global indent

2014-08-22 Thread Marko Rauhamaa
Rob Gaddi rgaddi@technologyhighland.invalid:

 Emacs and vim both have huge learning curves

Really now?

When you start emacs, it advises you to start the builtin tutorial.
That's how I learned it in the 1980's and didn't experience any learning
curve.

Nowadays, emacs has a GUI that makes you productive immediately without
any keyboard commands. I have seen complete newbies adopt emacs without
any kind of duress or hardship.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Global indent

2014-08-22 Thread Neil D. Cerutti

On 8/22/2014 3:54 PM, Rob Gaddi wrote:

On Fri, 22 Aug 2014 15:46:33 -0400
Seymore4Head Seymore4Head@Hotmail.invalid wrote:


On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:


Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?


Ok.so the answer is no using IDLE (Python GUI)

The top two answers so far are Emacs and gvim.

http://gvim.en.softonic.com/  Has a snazzy look, but I think it is not
compatible with Windows so it looks like I might have to try Emacs.


gvim runs just fine on Windows. http://www.vim.org/download.php


Thanks everyone


Emacs and vim both have huge learning curves that I've decided aren't
worth climbing.  Notepad++ is an excellent GUI text editor for Windows.
Geany is nearly as good, and runs on anything.


They do have a very long learning incline but it isn't actually as steep 
as it looks--it's just that it keeps going up as far as you can see.  :)


If simple things weren't simple to do, neither product would have ever 
succeeded.


The GUI version of Vim (gvim), has beginner modes and Windows-like modes 
to help with the transitional phases.


--
Neil Cerutti

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


Re: Global indent

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:
 On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head
 Seymore4Head@Hotmail.invalid wrote:

Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?

 Ok.so the answer is no using IDLE (Python GUI)

This is very much an editor question, so you ought to have said *right
at the beginning* that you're using Idle's editor.

Try selecting a bunch of text and hitting Tab.

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


Re: Halfway point between interactive and daemon?

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 5:27 AM, Travis Griggs travisgri...@gmail.com wrote:
 I’m curious if there’s a technique one could use to get half way there. 
 Basically, with minimal modifications, I’d like to get it running at startup.

Okay, hold on a minute there. There are two quite separate things
here: daemonization, and starting on system startup.

Daemonization is actually unnecessary to the latter, if you use a
modern init system. Just write your program to never fork, and either
Upstart or systemd will happily monitor it. Just create a unit file,
something like this:

[Unit]
Description=Yosemite Project
[Service]
Environment=DISPLAY=:0.0
User=whichever_user_to_run_as
ExecStart=/usr/bin/python /path/to/your/script
# If the network isn't available yet, restart until it is.
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target

$ systemctl --system daemon-reload
$ systemctl enable yos.service
$ systemctl start yos.service

(Feel free to steal that for your own purposes. It came from my
MIT-licensed videos server project Yosemite.)

Daemonization should be optional. The above unit file works fine for
something that doesn't fork itself away. (I'm not sure how systemd
works with daemonizing processes, never tried. In any case, it's
unnecessary.) If you do need it (so the user can start your program
from the command line), I strongly recommend picking up a module off
PyPI; there are actually a lot of little details that people will
expect you to have gotten right. May as well bury it all away in a
little daemonize() call :)

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


Re: Global indent

2014-08-22 Thread Mark Lawrence

On 22/08/2014 21:20, Chris Angelico wrote:

On Sat, Aug 23, 2014 at 5:46 AM, Seymore4Head
Seymore4Head@hotmail.invalid wrote:

On Fri, 22 Aug 2014 14:19:29 -0400, Seymore4Head
Seymore4Head@Hotmail.invalid wrote:


Is there a way to indent everything again?

Say I have a while statement with several lines of code and I want to
add a while outside that.  That means indenting everything.  Is there
a global way to do that?


Ok.so the answer is no using IDLE (Python GUI)


This is very much an editor question, so you ought to have said *right
at the beginning* that you're using Idle's editor.

Try selecting a bunch of text and hitting Tab.

ChrisA



There are also indent and dedent options on the format menu.  Using 
default settings on Windows 8.1, python 3.4.1 these are CTRL+] and 
CTRL+[ respectively.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Global indent

2014-08-22 Thread Dan Stromberg
On Fri, Aug 22, 2014 at 1:16 PM, Neil D. Cerutti ne...@norwich.edu wrote:
 Emacs and vim both have huge learning curves that I've decided aren't
 worth climbing.  Notepad++ is an excellent GUI text editor for Windows.
 Geany is nearly as good, and runs on anything.


 They do have a very long learning incline but it isn't actually as steep as
 it looks--it's just that it keeps going up as far as you can see.  :)

 If simple things weren't simple to do, neither product would have ever
 succeeded.

 The GUI version of Vim (gvim), has beginner modes and Windows-like modes to
 help with the transitional phases.

Learning vi:
http://stromberg.dnsalias.org/~strombrg/vi.ref.6

The first time I saw vi, I hated it.  I thought Why would anyone
actually choose such a terrible editor?

But then I was forced to use vi for a while,  and I'm glad I was.  I
choose it over other editors now.  vi/vim give you a pretty much
orthogonal set of verbs and nouns in an editing language.

When I have to use editors that make you arrow-key around or click
with a mouse, I feel like it's painfully slow - especially if I need
to do the same thing 5 times in a row.  Sure, some editors let you
define macros - vi/vim do that too. But AFAIK, only vi/vim allow you
to define a repeatable action without forethought.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/22/2014 02:06 PM, Marko Rauhamaa wrote:
 I tend to think the opposite: C++ barely has a niche left. I definitely
 wouldn't want to use C++ very far from its (very narrow) sweet spot.

I agree that it's niche is narrowing.  But it's still pretty wide and
widely used.  Many adobe products are C++, for example.  OpenOffice and
LibreOffice is C++.  You could argue that's because they are old
projects and were started in C++. But honestly if you were
reimplementing OpenOffice today what would you choose?  Python would be
appropriate for certain aspects of OO, such as parts of the UI, macros,
filters, etc.  I certainly wouldn't want to use Java (contrary to
popular belief OO is not written in Java; it's definitely C++).  Go is
quite young but promising except that unicode is all UTF-8 byte strings,
so string operations are going to be a bit slow.  C# never lived up to
its promise as the next app development language, even on Windows.  So
at this moment I'd still do it in C++ I think.  Apple chose to use C++
to build clang and llvm in, rather than C.

 My disillusionment with C++ came from the language's inability to
 represent callbacks. C can do it (void *), C# can do it (delegates),
 Java can do it (anonymous inner classes), Python can do it (methods),
 Scheme can do it (closures).

C++ can do it quite well, actually.  Maybe not quite as nicely as
Python.  But boost and libsigc++ both offer nice, type-safe ways to
implement signals and slots.  You can pass references to a callback
around in an easy, safe way.

 Qt needs callbacks (signals IIRC). It doesn't use C++ to express them.
 It uses a fricking metacompiler for them.

This is only partially true.  The actual, original, .cpp files with Qt
macros in them compile directly on the C++ compiler.  moc runs on the .h
file to generate some supporting code to help with event dispatching.
There's no such thing as Qt C++.  It's all standard C++, with macros to
help when defining things such as signals.

Macros were chosen instead of templates because at the time, not all C++
compilers supported templates.  Now if it was done all over again,
they'd do something like libsigc++, or boost.

 And Stroustrup's thick book didn't even seem to be aware of callbacks as
 a paradigm and thus didn't show any examples of dealing with them. Too
 bad Stroustrup wasn't aware of C#'s delegates; C++ should have defined
 function pointers as delegates.

Maybe the language doesn't need to implement them as keywords because
it's already possible to do safely with templates.  libsigc++ is a great
implementation that works really well (and it's quite fast at
dispatching events).  libsigc++ has an advantage over Qt in that the
signals are actual type-safe template objects.  Qt's signals are
actually strings under the hood, and I've had weird name clash issues in
the past when I didn't realize that.  Can't remember the circumstances
or the details now.  Basically something that should have been caught at
compile time became a runtime error.

Doing event-driven programming with Gtkmm and libsigc++ is actually
pretty darn nice and is right at home in C++.

 There is one big advantage C++ has over C: virtual method dispatching.
 However, I have been able to come up with C idioms that make practical
 method dispatching relatively painless.

Seems like Vala might fit this niche pretty well.

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


Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 7:38 AM, Michael Torrie torr...@gmail.com wrote:
 On 08/22/2014 02:06 PM, Marko Rauhamaa wrote:
 I tend to think the opposite: C++ barely has a niche left. I definitely
 wouldn't want to use C++ very far from its (very narrow) sweet spot.

 I agree that it's niche is narrowing.  But it's still pretty wide and
 widely used.  Many adobe products are C++, for example.  OpenOffice and
 LibreOffice is C++.  You could argue that's because they are old
 projects and were started in C++. But honestly if you were
 reimplementing OpenOffice today what would you choose?  Python would be
 appropriate for certain aspects of OO, such as parts of the UI, macros,
 filters, etc. ...

Frankly, I wouldn't write OO in anything, because I think the entire
concept of a WYSIWYG editor is flawed. Much better to use markup and
compile it. But if I were to write something like that, probably what
I'd do would be to write a GUI widget in whatever lowish-level
language is appropriate (probably C, with most GUI toolkits), and then
use a high level language (probably Python or Pike) to build the
application. I'm not familiar with all of OO/LO's components, but I
believe that model will probably work for all of them (the document
editor, obviously; the presentation editor might be done a bit
differently, but it'd still work this way; the spreadsheet quite
possibly doesn't even need a custom widget; etc).

 My disillusionment with C++ came from the language's inability to
 represent callbacks. C can do it (void *), C# can do it (delegates),
 Java can do it (anonymous inner classes), Python can do it (methods),
 Scheme can do it (closures).

 C++ can do it quite well, actually.  Maybe not quite as nicely as
 Python.  But boost and libsigc++ both offer nice, type-safe ways to
 implement signals and slots.  You can pass references to a callback
 around in an easy, safe way.

My main issue with callbacks in either C or C++ is that functions
aren't first-class objects. You can pass function pointers around (and
you don't need (void *) to do it, you can use typed function pointers
just fine), but you can't actually construct a function at run-time.

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


Re: Python vs C++

2014-08-22 Thread Michael Torrie
On 08/22/2014 03:49 PM, Chris Angelico wrote:
 My main issue with callbacks in either C or C++ is that functions
 aren't first-class objects. You can pass function pointers around (and
 you don't need (void *) to do it, you can use typed function pointers
 just fine), but you can't actually construct a function at run-time.

I'm not sure I fully understand your meaning.  You seem to prefer
dynamic languages, which is great because this is the Python list after
all.  I'm not sure I know of any statically compiled language that lets
one construct a function at run-time.  I know Boost supports lambda
functions but I'm not sure this is quite what you are referring to either.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python vs C++

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 7:56 AM, Michael Torrie torr...@gmail.com wrote:
 On 08/22/2014 03:49 PM, Chris Angelico wrote:
 My main issue with callbacks in either C or C++ is that functions
 aren't first-class objects. You can pass function pointers around (and
 you don't need (void *) to do it, you can use typed function pointers
 just fine), but you can't actually construct a function at run-time.

 I'm not sure I fully understand your meaning.  You seem to prefer
 dynamic languages, which is great because this is the Python list after
 all.  I'm not sure I know of any statically compiled language that lets
 one construct a function at run-time.  I know Boost supports lambda
 functions but I'm not sure this is quite what you are referring to either.

Right, I'm just saying that callbacks are inherently restrictive in a
language without first-class functions. So I'm not sure why you have
further issue with C++; C's way of doing callbacks works fine in C++,
and there's not going to be anything better.

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


Re: Som confusion about the python library installation

2014-08-22 Thread Chris Angelico
On Sat, Aug 23, 2014 at 1:46 AM, Jiafan Zhou zhoujia...@gmail.com wrote:
 Another separate question in relation, do I really need to install the 
 python-nose in ubuntu. Can I not just go directly to pip and install the nose 
 library?


If you're going to use pip to install nose, I recommend not having it
installed via apt-get. You should be able to remove the Ubuntu package
and just use pip (you may have to reinstall with pip after removing
with apt-get), and then you don't have to worry about accidental
upgrades.

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


Re: Why can not initialize the class?

2014-08-22 Thread Terry Reedy

On 8/22/2014 10:26 AM, luofeiyu wrote:

System:win7+python34.

 class Contact(object):
 def __init__(self, first_name=None, last_name=None,
  display_name=None, email=None):
 self.first_name = first_name
 self.last_name = last_name
 self.display_name = display_name
 self.email = email
 def print_info(self):
 print(self.display_name,  + self.email +   )
 def set_email(self, value):
 if '@' not in value:
 raise Exception(This doesn't look like an email
address.)
 self._email = value
 def get_email(self):
 return self._email
 email = property(get_email, set_email)

 contact = Contact()


By posting code with an extra indent, you make it imposible to run by 
just cutting and pasting. You should already know that.


--
Terry Jan Reedy

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


Re: Why can not initialize the class?

2014-08-22 Thread Ben Finney
Terry Reedy tjre...@udel.edu writes:

 By posting code with an extra indent, you make it imposible to run by
 just cutting and pasting. You should already know that.

I commonly do that, as I do with most block quotes in plain text.

I think it's a reasonable expectation that programmers, reading a forum
about program code, will have at hand a programmer's editor capable of
stripping a level of indentation from a block of code.

-- 
 \ “Cross country skiing is great if you live in a small country.” |
  `\—Steven Wright |
_o__)  |
Ben Finney

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


Re: Why can not initialize the class?

2014-08-22 Thread luofeiyu

One final version:

class Contact(object):
def __init__(self, email=haha@haha):
self.email = email
def _get_email(self):
return self._the_secret_private_email
def _set_email(self, value):
self.self._the_secret_private_email = value
email = property(_get_email, _set_email)

contact = Contact()
print(contact.email)

There is a little mistake here. It is

self._the_secret_private_email = value

not

self.self._the_secret_private_email = value

think for your demo .The value in `def _set_email(self, value):` is the value 
of self.email .


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


Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Dan Stromberg
On Thu, Aug 21, 2014 at 12:55 AM,  icefap...@gmail.com wrote:
 Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic 
 (in a we-are-all-grown-ups fashion, ahem)enough to get its way into the 
 language
 this is what yours truly thinks: don't we all know that : means the next 
 token must be an indent (mostly)? and doesn't the ( and its alikes, [ and } 
 begin an space-insensitive lexing context? so all we need is having an 
 space-sensitivity-stack and the corresponding ( counting stack and this 
 way we could match opening and closing () and pop the 
 space-sensitivity-stack whenever the ( counting stack gets a 0 at the top:
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: proposed syntax for multiline anony-functions (hopefully?)

2014-08-22 Thread Dan Stromberg
On Thu, Aug 21, 2014 at 12:55 AM,  icefap...@gmail.com wrote:
 Hi, just wanting to do a shot in the dark,but maybe this syntax is Pythonic 
 (in a we-are-all-grown-ups fashion, ahem)enough to get its way into the 
 language
 this is what yours truly thinks: don't we all know that : means the next 
 token must be an indent (mostly)? and doesn't the ( and its alikes, [ and } 
 begin an space-insensitive lexing context? so all we need is having an 
 space-sensitivity-stack and the corresponding ( counting stack and this 
 way we could match opening and closing () and pop the 
 space-sensitivity-stack whenever the ( counting stack gets a 0 at the top:

Please don't add multiline lambdas to Python.

Multiline lambdas give rise (in a big way) to the
computer-language-equivalent of run-on sentences.

If anything, I'd suggest removing single-line lambdas.  List
comprehensions and generator expressions render single-line lambdas
almost entirely redundant; they're too TMTOWTDI.

http://en.wikipedia.org/wiki/Run-on_sentence
http://en.wikipedia.org/wiki/There's_more_than_one_way_to_do_it
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python-daemon for Python v3

2014-08-22 Thread Y@i$el
A mi si me ha dado problemas. No tengo forma de decirle que se ejecute como 
usuario www-data y cuando lo intento deja de funcionar abruptamente. Saludos.

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


Re: Halfway point between interactive and daemon?

2014-08-22 Thread Cameron Simpson

On 22Aug2014 12:27, Travis Griggs travisgri...@gmail.com wrote:
I’m curious if there’s a technique one could use to get half way there.  
Basically, with minimal modifications, I’d like to get it running at startup.  
So I can put a line like this in rc.local


nohup python3 myMain.py 21  /var/log/mylog.log 


Just to this. You have your redirections backwards. They are applied left to 
right. So, first 21: sending stderr to where stdout currently goes 
(probably the system console if this runs from rc.local). Then,  
/var/log/mylog.log: sending current stdout to the log file. Importantly, _not_ 
attaching stderr to the log file.


You want to write this:

  command log 21

As others have remarked, you do not need to daemonise a process started from 
rc.local.


And as others have remarked, if you want it to start/stop under external 
conrol, or restart after a program abort etc, you may be better adding it as to 
the configuration of something like systemd or init.


That said, I start a bunch of things in rc.local. It is quick and easy, and 
also handy for stuff that shouldn't be restarted automatically if it dies.


Then I can “check” on it when I need to with a tail -f /var/log/mylog.log. But 
then I have the problem of managing the log size. And also I either have to 
wait for stdout to flush, or insert sys.stdout.flush() after any of my 
print()’s.


Log messages should be going to stderr anyway, which by default is unbuffered.

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

You can't have everything...  where would you put it?
- Charles Robinson, cr0...@medtronic.com
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why can not initialize the class?

2014-08-22 Thread Terry Reedy

On 8/22/2014 7:28 PM, Ben Finney wrote:

Terry Reedy tjre...@udel.edu writes:


By posting code with an extra indent, you make it imposible to run by
just cutting and pasting. You should already know that.


I commonly do that,


It is unnecessary and extra work on both ends. It is also ambiguous in 
that there may be a missing unindented line.


 as I do with most block quotes in plain text.

Code is not text, especially not python code.
Indents do not change the meaning of text.

 I think it's a reasonable expectation that programmers, reading a
 forum about program code, will have at hand a programmer's editor
 capable of stripping a level of indentation from a block of code.

Well yes, people here generally have Idle at hand, which can do it 
easily. However, it is unreasonable (and counterfactual -- see other 
thread today) to expect everyone to know that, or remember if they ever 
did know.  It also requires that one get *all* the indentation and not 
miss the first space.


--
Terry Jan Reedy

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


Re: python-daemon for Python v3

2014-08-22 Thread Terry Reedy

On 8/22/2014 9:09 PM, Y@i$el wrote:

A mi si me ha dado problemas. No tengo forma de decirle que se ejecute como 
usuario www-data y cuando lo intento deja de funcionar abruptamente.


I can almost, but not really understand and translate the question.

Possiblemente debe visitar un grupo in espanol.
news.gmane.org tiene
gmane.comp.python.general.castellano o
gmane.comp.python.general.hispano

Por un tiempo, lei'
http://python.org.ar/ListaDeCorreo

--
Terry Jan Reedy

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


Re: the output in reference of descriptor.

2014-08-22 Thread Ian Kelly
On Thu, Aug 21, 2014 at 7:25 PM, luofeiyu elearn2...@gmail.com wrote:
  c2.d.a
 __get__() is called __main__.C2 object at 0x0297BE10 class
'__main__.
 C2'
 __getattribute__() is called
 'abc'

 Why the result of c2.d.a  is not :

 __get__() is called __main__.C2 object at 0x0297BE10 class
'__main__.
 C2'
 __getattribute__() is called
 'abc'

As far as I can tell you pasted the same output twice, so I don't
understand what it is that you're asking.

 Why the` return self` in the __get__ method in class C  does not work?

It does work. When you type c2.d above, the result was the C instance,
i.e. self.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the output in reference of descriptor.

2014-08-22 Thread CHIN Dihedral
On Friday, August 22, 2014 9:25:02 AM UTC+8, luofeiyu wrote:
 class C(object):
 

Well, in python class is treated 
as onte of the first class built in
operations.

class new_class_ame ( parentclasses)


Please check this syntax first in Python.
  a = 'abc'
 
  def __getattribute__(self, *args, **kwargs):
 
  print(__getattribute__() is called)
 
  return object.__getattribute__(self, *args, **kwargs)
 
  def __getattr__(self, name):
 
  print(__getattr__() is called )
 
  return name +  from getattr
 
  def __get__(self, instance, owner):
 
  print(__get__() is called, instance, owner)
 
  return self
 
  def foo(self, x):
 
  print(x)
 
 
 
 
 
  class C2(object):
 
  d = C()
 
 
 
 
 
   c2.d
 
 __get__() is called __main__.C2 object at 0x0297BE10 class 
 
 '__main__.
 
 C2'
 
 __main__.C object at 0x0297BBA8
 
 
 
 I understant the result ,c2.d trigger the __get__ method in class C.
 
  def __get__(self, instance, owner):
 
  print(__get__() is called, instance, owner)
 
  return self
 
 
 
 It print __get__() is called, instance, owner and return self 
 
 `__main__.C object at 0x0297BBA8`
 
 
 
 
 
   c2.d.a
 
 __get__() is called __main__.C2 object at 0x0297BE10 class 
 
 '__main__.
 
 C2'
 
 __getattribute__() is called
 
 'abc'
 
 
 
 Why the result of c2.d.a  is not :
 
 
 
 __get__() is called __main__.C2 object at 0x0297BE10 class 
 
 '__main__.
 
 C2'
 
 __getattribute__() is called
 
 'abc'
 
 
 
 Why the` return self` in the __get__ method in class C  does not work?

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


Re: Python vs C++

2014-08-22 Thread dieter
Christian Gollwitzer aurio...@gmx.de writes:
 ...
 * Java: I don't see that it is much higher level than C++. It has a
 GC, but that's all, and you can have that in C++, too, if you want. On
 the other hand, you loose the metaprogramming facilities provided by
 C++ templates (needs a guru to make a library, but can be handy and
 easy to use, e.g. everything in Boost). You loose direct memory
 access, gaining what? no idea.

Automatic memory compaction -- which can be quite helpfull with
long running applications (avoiding memory fragmentation).

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


Re: Python vs C++

2014-08-22 Thread dieter
Chris Angelico ros...@gmail.com writes:
 Frankly, I wouldn't write OO in anything, because I think the entire
 concept of a WYSIWYG editor is flawed.

That would limit (so called) office applications to experts only.
But the success of these applications relies on the fact, that
even a complete novice can immediately use them. For non-experts
WYSIWYG editors are important.

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


[issue22237] sorted() docs should state that the sort is stable

2014-08-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'll update the docs for sorted().

--
priority: normal - low
versions:  -Python 3.1, Python 3.2, Python 3.3

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



[issue22243] Documentation on try statement incorrectly implies target of except clause can be any assignable expression

2014-08-22 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
keywords: +easy
versions: +Python 2.7

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



[issue22208] tarfile can't add in memory files (reopened)

2014-08-22 Thread Lars Gustäbel

Lars Gustäbel added the comment:

Please provide a patch which allows easy addition of file-like objects (not 
only io.BytesIO) and directories, preferably hard and symbolic links, too. It 
would be nice to still be able to change attributes of a TarInfo before 
addition. Please also add tests.

--
stage:  - needs patch
type: behavior - enhancement

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



[issue21817] `concurrent.futures.ProcessPoolExecutor` swallows tracebacks

2014-08-22 Thread Claudiu Popa

Claudiu Popa added the comment:

Any type of feedback regarding this approach will be appreciated.

--

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



[issue22243] Documentation on try statement incorrectly implies target of except clause can be any assignable expression

2014-08-22 Thread Jayanth Koushik

Jayanth Koushik added the comment:

The whole page on compound statements seems to be rife with inconsistencies.

--

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



[issue22248] urllib.request.urlopen raises exception when 30X-redirect url contains non-ascii chars

2014-08-22 Thread Tomas Groth

New submission from Tomas Groth:

Running this simple test script produces the traceback show below.

import urllib.request
page = 
urllib.request.urlopen('http://legacy.biblegateway.com/versions/?vid=DN1933action=getVersionInfo#books')

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/urllib/request.py, line 153, in urlopen
return opener.open(url, data, timeout)
  File /usr/lib/python3.4/urllib/request.py, line 461, in open
response = meth(req, response)
  File /usr/lib/python3.4/urllib/request.py, line 571, in http_response
'http', request, response, code, msg, hdrs)
  File /usr/lib/python3.4/urllib/request.py, line 493, in error
result = self._call_chain(*args)
  File /usr/lib/python3.4/urllib/request.py, line 433, in _call_chain
result = func(*args)
  File /usr/lib/python3.4/urllib/request.py, line 676, in http_error_302
return self.parent.open(new, timeout=req.timeout)
  File /usr/lib/python3.4/urllib/request.py, line 455, in open
response = self._open(req, data)
  File /usr/lib/python3.4/urllib/request.py, line 473, in _open
'_open', req)
  File /usr/lib/python3.4/urllib/request.py, line 433, in _call_chain
result = func(*args)
  File /usr/lib/python3.4/urllib/request.py, line 1258, in http_open
return self.do_open(http.client.HTTPConnection, req)
  File /usr/lib/python3.4/urllib/request.py, line 1232, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
  File /usr/lib/python3.4/http/client.py, line 1065, in request
self._send_request(method, url, body, headers)
  File /usr/lib/python3.4/http/client.py, line 1093, in _send_request
self.putrequest(method, url, **skips)
  File /usr/lib/python3.4/http/client.py, line 957, in putrequest
self._output(request.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: 
ordinal not in range(128)


Using curl we can see that there is a redirect to an url with a special char:
$ curl -vs 
http://legacy.biblegateway.com/versions/?vid=DN1933action=getVersionInfo#books;
 DN1933
* Hostname was NOT found in DNS cache
*   Trying 23.23.93.211...
* Connected to legacy.biblegateway.com (23.23.93.211) port 80 (#0)
 GET /versions/?vid=DN1933action=getVersionInfo HTTP/1.1
 User-Agent: curl/7.35.0
 Host: legacy.biblegateway.com
 Accept: */*
 
 HTTP/1.1 301 Moved Permanently
* Server nginx/1.4.7 is not blacklisted
 Server: nginx/1.4.7
 Date: Fri, 22 Aug 2014 08:35:30 GMT
 Content-Type: text/html; charset=UTF-8
 Content-Length: 0
 Connection: keep-alive
 X-Powered-By: PHP/5.5.7
 Set-Cookie: bg_id=1b9a80d5e6d545487cfd153d6df65c4e; path=/; 
domain=.biblegateway.com
 Set-Cookie: a9gl=0; path=/; domain=.biblegateway.com
 Location: 
http://legacy.biblegateway.com/versions/Dette-er-Biblen-på-dansk-1933/
 
* Connection #0 to host legacy.biblegateway.com left intact


When the redirect-url doesn't contain special chars everything works as 
expected, like with this url: 
http://legacy.biblegateway.com/versions/?vid=DNB1930action=getVersionInfo#books;

--
components: Library (Lib)
messages: 225651
nosy: tomasgroth
priority: normal
severity: normal
status: open
title: urllib.request.urlopen raises exception when 30X-redirect url contains 
non-ascii chars
type: behavior
versions: Python 3.4

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



[issue13938] 2to3 fails to convert types.StringTypes appropriately

2014-08-22 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage:  - commit review
type:  - enhancement

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



[issue16599] unittest: Access test result from tearDown

2014-08-22 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
resolution:  - rejected
stage: needs patch - resolved
status: open - closed

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



[issue22248] urllib.request.urlopen raises exception when 30X-redirect url contains non-ascii chars

2014-08-22 Thread Tomas Groth

Tomas Groth added the comment:

Small correction. Use this url for a working redirect instead of the one given 
at the end of the first comment:
http://legacy.biblegateway.com/versions/?vid=ESVaction=getVersionInfo#books

--

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



[issue22197] Allow better verbosity / output control in test cases

2014-08-22 Thread Michael Foord

Michael Foord added the comment:

This seems like a reasonable improvement, I'd be in favour. I'd be *slightly* 
concerned that a test can override an explicit verbosity setting of the user, 
but I guess that annoyance is up to the test writer (they should check for an 
explicit setting first).

--

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



[issue22245] test_urllib2_localnet prints out error messages

2014-08-22 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Interesting. I had not noticed these with my run on Mac and neither did 
Buildbots report. Looks like explicit closing of wfile do_GET method can be 
cause of tis problem.

--

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



[issue22247] More incomplete module.__all__ lists

2014-08-22 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue18374] ast.parse gives wrong position (col_offset) for some BinOp-s

2014-08-22 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage:  - patch review
type:  - behavior
versions: +Python 3.5 -Python 3.2, Python 3.3

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



[issue22245] test_urllib2_localnet prints out error messages

2014-08-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 48a77fbfd6cb by Senthil Kumaran in branch '3.4':
Fix issue22245 - Fix urllib2_localnet test.
http://hg.python.org/cpython/rev/48a77fbfd6cb

New changeset cb291294bdc8 by Senthil Kumaran in branch 'default':
merge from 3.4
http://hg.python.org/cpython/rev/cb291294bdc8

--
nosy: +python-dev

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



[issue22245] test_urllib2_localnet prints out error messages

2014-08-22 Thread Senthil Kumaran

Senthil Kumaran added the comment:

It was reproducible on my local machine too. Those errors were present and 
somehow escaped me. Thanks for raising this.

Fixed these and tested in my local machine and test_urllib2_localnet was 
successful.

--
assignee:  - orsenthil
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue21669] Custom error messages when print exec are used as statements

2014-08-22 Thread Nick Coghlan

Nick Coghlan added the comment:

For the record, I just posted the QA reference to Stack Overflow: 
https://stackoverflow.com/questions/25445439/what-does-syntaxerror-missing-parentheses-in-call-to-print-mean-in-python/

--

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



[issue22098] Behavior of Structure inconsistent with BigEndianStructure when using __slots__

2014-08-22 Thread Claudiu Popa

Claudiu Popa added the comment:

That makes sense. Quoting from the data model: When inheriting from a class 
without __slots__, the __dict__ attribute of that class will always be 
accessible, so a __slots__ definition in the subclass is meaningless.
In the current case, for the little-endian systems, which I presume you have, 
BigEndianStructure is a subclass of Structure, but it doesn't have a definition 
of __slots__ in the body, leading to your results, according to the 
specificaton from the data model. In this case, it makes sense for Point1 to 
have __slots__, but not for Point2.

--
nosy: +Claudiu.Popa

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



[issue21817] `concurrent.futures.ProcessPoolExecutor` swallows tracebacks

2014-08-22 Thread Ram Rachum

Ram Rachum added the comment:

Hi Claudiu, sorry for the silence.

This output looks great. I'd love to see that go into Python.

--

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



[issue22249] Possibly incorrect example is given for socket.getaddrinfo()

2014-08-22 Thread Alexander Patrakov

New submission from Alexander Patrakov:

See the example at 
https://docs.python.org/2/library/socket.html#socket.getaddrinfo

 socket.getaddrinfo(www.python.org, 80, 0, 0, socket.SOL_TCP)

As I am primarily a C programmer, it is quite surprising for me to see a SOL_* 
being passed into the proto argument. I thought that SOL_* is only for 
setsockopt(), and IPPROTO_* would be suitable. Yes, for TCP and UDP the SOL_* 
and IPPROTO_* constants are the same, but see e.g. 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms737530%28v=vs.85%29.aspx
 which specifically points out that IPPROTO_* constants as acceptable values.

--
assignee: docs@python
components: Documentation
messages: 225659
nosy: Alexander.Patrakov, docs@python
priority: normal
severity: normal
status: open
title: Possibly incorrect example is given for socket.getaddrinfo()
type: behavior
versions: Python 2.7

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



[issue22118] urljoin fails with messy relative URLs

2014-08-22 Thread Stefan Behnel

Stefan Behnel added the comment:

I'm now getting duplicated slashes in URLs, e.g.:

https://new//foo.html
http://my.little.server/url//logo.gif

In both cases, the base URL that gets joined with the postfix had a trailing 
slash, e.g.

http://my.little.server/url/; + logo.gif - 
http://my.little.server/url//logo.gif;

--
nosy: +scoder

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



[issue22118] urljoin fails with messy relative URLs

2014-08-22 Thread Nick Coghlan

Nick Coghlan added the comment:

Issue #1500504 (the urischemes proposal that never got turned into a PyPI 
package) has several additional test cases. This particular attachment is one 
AMK cleaned up to run on Py3k:

http://bugs.python.org/file32591/urischemes.py

The module itself likely isn't worth salvaging, but the additional examples in 
the test cases were very useful in flushing out various RFC compliance issues.

--

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



[issue22247] More incomplete module.__all__ lists

2014-08-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Issue 20689: socket.__all__

--
nosy: +serhiy.storchaka

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



[issue21338] Silent mode for compileall

2014-08-22 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
assignee:  - berker.peksag
nosy: +berker.peksag

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



[issue22197] Allow better verbosity / output control in test cases

2014-08-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Oh, I'm only proposing read-only access to the verbosity information. And 
forcing output buffering would only last for the current test method, of course.

--

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



[issue19714] Add tests for importlib.machinery.WindowsRegistryFinder

2014-08-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a21ddb1c41d2 by Brett Cannon in branch 'default':
Issue #19714: Tests for importlib.machinery.WindowsRegistryFinder.
http://hg.python.org/cpython/rev/a21ddb1c41d2

--
nosy: +python-dev

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



[issue19714] Add tests for importlib.machinery.WindowsRegistryFinder

2014-08-22 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch, Claudiu. Sorry it took so long to apply, but you know 
what I have been working on instead so I'm sure you understand. =)

--
resolution:  - fixed
status: open - closed

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



[issue22191] warnings.__all__ incomplete

2014-08-22 Thread Brett Cannon

Brett Cannon added the comment:

And Python 2.7.

--
status: pending - open

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



[issue22240] argparse support for python -m module in help

2014-08-22 Thread Miki Tebeka

Miki Tebeka added the comment:

For zip file the help should probably be:
usage: python file.zip

--

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



[issue19714] Add tests for importlib.machinery.WindowsRegistryFinder

2014-08-22 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: commit review - resolved

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



  1   2   >