Re: Can Python function return multiple data?

2015-06-04 Thread Marko Rauhamaa
Grant Edwards invalid@invalid.invalid: Anyway, I would say Python definitely is in the classic pass-by-value camp. Here's a simple test: def f(x): x = 3 y = 1 f(y) print(y) If it prints 1, it's pass by value. If it prints 3, it's pass by reference. Somebody else

Re: Calling Python Script from an SQL Proceudre

2015-06-04 Thread Amit Goutham
Hi Laura, Thanks a Lot for the reply. I wanted to know if calling a Python script from SAP HANA database is possible. Thanks! On Jun 3, 2015 9:43 PM, Laura Creighton l...@openend.se wrote: In a message of Wed, 03 Jun 2015 15:17:16 +0530, Amit Goutham writes: Hi All, I am trying to search on

Re: Can Python function return multiple data?

2015-06-04 Thread Michael Torrie
On 06/03/2015 04:28 PM, sohcahto...@gmail.com wrote: People actually argue that Python passes by value? This is easily proven wrong by passing a mutable object to a function and changing it within the function. Sure but if you reassign the variable that was passed it, it has no effect

Re: Can Python function return multiple data?

2015-06-04 Thread Marko Rauhamaa
Steven D'Aprano st...@pearwood.info: But you still find a few people here and there who have been exposed to Java foolishness, and will argue that Python is pass by value, where the value is an implementation dependent reference to the thing that you thought was the value. Why fight

[issue24379] slice.literal notation

2015-06-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I like this idea. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24379 ___ ___

[issue24379] slice.literal notation

2015-06-04 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24379 ___

Re: Can Python function return multiple data?

2015-06-04 Thread Serhiy Storchaka
On 03.06.15 02:56, Chris Angelico wrote: On Wed, Jun 3, 2015 at 7:27 AM, fl rxjw...@gmail.com wrote: I just see the tutorial says Python can return value in function, it does not say multiple data results return situation. In C, it is possible. How about Python on a multiple data return

Re: Multiple thread program problem

2015-06-04 Thread Gary Herron
On 06/03/2015 01:41 PM, Mohan Mohta wrote: Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1=ssh -B

[issue23237] Interrupts are lost during readline PyOS_InputHook processing (reopening)

2015-06-04 Thread Martin Panter
Martin Panter added the comment: Hi Michiel, if you are looking for the source of https://docs.python.org/dev/c-api/veryhigh.html#c.PyOS_InputHook, that corresponds to Doc/c-api/veryhigh.rst in the repository. This bug would be fairly easy to solve for “tkinter” if we could drop the

Re: build a deb-package

2015-06-04 Thread Mihamina Rakotomandimby
On 06/04/2015 04:08 AM, c.bu...@posteo.jp wrote: On Ubuntu when ... ... I used setup.py bdist_rpm and alien to create a deb. You got it the hard way :-) Why wont you try another way? Here are some links from my bookmarks:

build a deb-package

2015-06-04 Thread c.buhtz
I am not sure where I am or where to go. ;) So before asking about technical details I first want to know if it is generally possible. On Ubuntu when I install python-based applications (from a repository) as deb-packages I can start them by just typing its name because the py-file or a link to

[issue24379] slice.literal notation

2015-06-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not index the slice type itself? slice[1:2] Another feature of the new `literal` object is that it is not limited to just the creation of `slice` instances; instead, it is designed to mix slices and other types together. This looks as disadvantage.

Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Russell Brennan
I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() Or is it proper form to use a short-circuiting boolean: def

Multiple thread program problem

2015-06-04 Thread Sam Raker
proc(f) isn't a callable, it's whatever it returns. IIRC, you need to do something like 'start_new_thread(proc, (f,))' -- https://mail.python.org/mailman/listinfo/python-list

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Ben Finney
Russell Brennan russelljbren...@gmail.com writes: I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() That is the

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Peter Otten
Frank Millman wrote: I have a slight variation in that I want to keep a reference to the argument - def __init__(self, arg=None): self.arg = arg or [] Based on your comment, I have changed it to - def __init__(self, arg=None): self.arg = [] if arg is None else arg Does

Re: Everything is an object in python - object class and type class

2015-06-04 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to get anywhere there, although RPython sounds intriguing.) Why not? We built the thing for people like you

Re: Keypress Input

2015-06-04 Thread Laura Creighton
In a message of Wed, 03 Jun 2015 20:59:04 +0200, Laura Creighton writes: Tkinter runs on raspberry pi. Get it installed, and then run this program. from Tkinter import * root = Tk() prompt = 'Press any key. Remember to keep your mouse in the cyan box. ' lab = Label(root, text=prompt,

Re: Find in ipython3

2015-06-04 Thread Michael Torrie
On 06/04/2015 09:12 AM, Cecil Westerhof wrote: Can't IPython just call the find and du utilities? That is what !find ~ -iname '*python*.pdf' does. But I do not find that aesthetically. Like I said, I find ipython to be hackish, but invoking find this way is no more hackish than writing

Re: Can Python function return multiple data?

2015-06-04 Thread Mark Lawrence
On 04/06/2015 19:34, Ian Kelly wrote: On Wed, Jun 3, 2015 at 3:56 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Now does Python pass by value or by reference? Happily sits back and waits for 10**6 emails to arrive as this is discussed for the 10**6th time. Troll. True indeed. As

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-06-04 Thread Yury Selivanov
Yury Selivanov added the comment: Alternative patch with monkeypatching instead of Future subclassing. -- Added file: http://bugs.python.org/file39623/concurrent_alt.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24383

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-06-04 Thread Guido van Rossum
Guido van Rossum added the comment: Sorry, I don't like that either. See my review. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24383 ___ ___

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-06-04 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: Added file: http://bugs.python.org/file39624/concurrent.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24383 ___

Re: Find in ipython3

2015-06-04 Thread Tim Chase
On 2015-06-04 13:09, Michael Torrie wrote: Why not use Python for what it's good for and say pipe the results of find into your python script? Reinventing find poorly isn't going to buy you anything. Until you port your app to Windows where find(1) is unavailable natively ;-) -tkc --

Re: Find in ipython3

2015-06-04 Thread Michael Torrie
On 06/02/2015 10:13 AM, Cecil Westerhof wrote: I am thinking about using ipython3 instead of bash. When I want to find a file I can do the following: !find ~ -iname '*python*.pdf' but is there a python way? No more than there is a bash-native way of doing find. Bash scripts use a myriad

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Frank Millman
Peter Otten __pete...@web.de wrote in message news:mkp10p$n0l$1...@ger.gmane.org... Russell Brennan wrote: I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1,

[issue24373] Use traverse finalize in xxlimited and in PEP 489 tests

2015-06-04 Thread Nick Coghlan
Nick Coghlan added the comment: Would it also be worth making at docs update to tp_dealloc, suggesting the use of tp_traverse/finalize?: https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_dealloc And perhaps from PyType_FromSpec?

[issue24374] Plug refleak in set_coroutine_wrapper

2015-06-04 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I'd missed that the previous code wouldn't clean up properly in the failure case. +1 for inlining the check and using the existing error label. -- ___ Python tracker rep...@bugs.python.org

[issue24373] Use traverse finalize in xxlimited and in PEP 489 tests

2015-06-04 Thread Petr Viktorin
Petr Viktorin added the comment: tp_traverse is completely orthogonal to tp_dealloc, it's needed to detect (and then break) reference cycles like: obj = xxlimited.Xxo() obj.foo = obj As for tp_finalize: yes, mentioning it in tp_dealloc docs would be good, but I'll need a bit more

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Peter Otten
Russell Brennan wrote: I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() Or is it proper form to use a

[issue24373] Use traverse finalize in xxlimited and in PEP 489 tests

2015-06-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 265eeb60443a by Nick Coghlan in branch '3.5': Issue #24373: Eliminate PEP 489 test refleaks https://hg.python.org/cpython/rev/265eeb60443a New changeset f24cd8bc5250 by Nick Coghlan in branch 'default': Merge fix for issue #24373 from 3.5

[issue16690] Reference leak with custom tp_dealloc in PyType_FromSpec

2015-06-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 265eeb60443a by Nick Coghlan in branch '3.5': Issue #24373: Eliminate PEP 489 test refleaks https://hg.python.org/cpython/rev/265eeb60443a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org

Re: Everything is an object in python - object class and type class

2015-06-04 Thread BartC
On 04/06/2015 11:06, Laura Creighton wrote: In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to get anywhere there, although RPython sounds intriguing.) Why

[issue5319] stdout error at interpreter shutdown fails to return OS error status

2015-06-04 Thread Martin Panter
Martin Panter added the comment: I guess this would involve: * Making a new API called Py_Finalize2() or something that returns the status * Redefine the existing Py_Finalize() to call Py_Finalize2() and ignore the return value -- ___ Python

Get html DOM tree by only basic builtin moudles

2015-06-04 Thread Wesley
Hi guys, I know there are many modules(builtin or not, e.g. beautifulsoup,xml,lxml,htmlparser .etc) to parse html files and output the DOM tree. However, if there is any better way to get the DOM tree without using those html/xml related modules? I mean, just by some general standard modules,

[issue24384] difflib.SequenceMatcher faster quick_ratio with lower bound specification

2015-06-04 Thread floyd
floyd added the comment: Now that I gave it another thought, I think it would be better if we simply add threshold as a named parameter of quick_ratio -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24384

[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-06-04 Thread Guido van Rossum
Guido van Rossum added the comment: Thinking about this more I think we should pass on this for now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24383 ___

[issue24384] difflib.SequenceMatcher faster quick_ratio with lower bound specification

2015-06-04 Thread floyd
New submission from floyd: I guess a lot of users of difflib call the SequenceMatcher in the following way (where a and b often have different lengths): if difflib.SequenceMatcher.quick_ratio(None, a, b) = threshold: However, for this use case the current quick_ratio is quite a performance

[issue5319] stdout error at interpreter shutdown fails to return OS error status

2015-06-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: We would probably call it Py_FinalizeEx(), but yes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5319 ___

[issue24373] Use traverse finalize in xxlimited and in PEP 489 tests

2015-06-04 Thread Nick Coghlan
Changes by Nick Coghlan ncogh...@gmail.com: -- resolution: - fixed stage: - resolved status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24373 ___

Re: Get html DOM tree by only basic builtin moudles

2015-06-04 Thread Laura Creighton
Elementtree is part of the Python standard library. You are better off using it than rolling your own. (If you were one of the rare people who have some very strange requirements that make you better off writing your own, you wouldn't be asking us. You'd already know.)

[issue24017] Implemenation of the PEP 492 - Coroutines with async and await syntax

2015-06-04 Thread Yury Selivanov
Yury Selivanov added the comment: Hmm, but IMHO a) the new syntax isn't just for asyncio and b) awaiting a Future seems like a *very* reasonable thing to do. I think opening a new ticket for this is a good idea. Stefan, I honestly have bo idea what concurrent.Future.__await__ would do.

[issue24379] slice.literal notation

2015-06-04 Thread Mark Dickinson
Mark Dickinson added the comment: For prior art, it's worth taking a look at NumPy, and in particular its `s_` and `index_exp` functions: import numpy as np np.s_[1:2] slice(1, 2, None) np.s_[0] 0 np.s_[1:2, 3] (slice(1, 2, None), 3) -- nosy: +mark.dickinson

[issue24379] slice.literal notation

2015-06-04 Thread Joe Jevnik
Joe Jevnik added the comment: Why not index the slice type itself? slice[1:2] I originally considered this and I personally really like this syntax, but I was concerned with ambiguity with the typing module The only question in my mind is what slice should do when given just a single

Re: How to access the low digits of a list

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 07:08 am, Rustom Mody wrote: So it means that indices can give indexerror; slices cannot? If you write your own class with a __getitem__ method, you can have it do anything you like, including raise an exception. Built-in sequence types like list, str and tuple, however,

Regular Expression

2015-06-04 Thread Palpandi
Hi All, This is the case. To split string2 from string1_string2 I am using re.split('_', string1_string2, 1)[1]. It is working fine for string string1_string2 and output as string2. But actually the problem is that if a sting is __string1_string2 and the output is _string1_string2. It is

Re: Everything is an object in python - object class and type class

2015-06-04 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 13:01:00 +0100, BartC writes: On 04/06/2015 11:06, Laura Creighton wrote: In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes: Mainly the language itself. But I've also been looking at the workings of CPython. (Also PyPy but obviously I'm not going to

mu-repo 1.1.1 released (python tool for dealing with multiple git repositories)

2015-06-04 Thread Fabio Zadrozny
mu-repo 1.1.1 now provides a workflow which allows cloning multiple repositories. See: http://fabioz.github.io/mu-repo/cloning/ for more details Also, now that there's actually a homepage, I believe even long time users may benefit from taking a look at the Tips Tricks page:

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 11:18 am, Russell Brennan wrote: I'm going to x-post this to stackoverflow but... When checking a method's arguments to see whether they were set, is it pythonic to do an identity check: def doThis(arg1, arg2=None): if arg2 is None: arg2 = myClass() Or is

Re: Regular Expression

2015-06-04 Thread Larry Martell
On Thu, Jun 4, 2015 at 9:36 AM, Palpandi palpandi...@gmail.com wrote: Hi All, This is the case. To split string2 from string1_string2 I am using re.split('_', string1_string2, 1)[1]. It is working fine for string string1_string2 and output as string2. But actually the problem is that if a

<    1   2