Re: Most probably a stupid question, but I still want to ask

2016-04-11 Thread Steven D'Aprano
On Monday 11 April 2016 14:03, Fillmore wrote: > I'll make sure I approach the temple of pythonistas bare-footed and with > greater humility next time Don't forget to rip your clothes into rags and heap ashes on your head too. -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-11 Thread Tim Chase
On 2016-04-11 01:33, MRAB wrote: > A one-element tuple can be written as: > > >>> ('hello',) > ('hello',) > > As has been said already, it's the comma that makes the tuple. The > parentheses are often needed to avoid ambiguity. Except when the comma *doesn't* make the tuple: >>> t = ()

Re: Most probably a stupid question, but I still want to ask

2016-04-11 Thread Rustom Mody
On Monday, April 11, 2016 at 11:12:39 AM UTC+5:30, Stephen Hansen wrote: > On Sun, Apr 10, 2016, at 10:18 PM, Rustom Mody wrote: > > On Monday, April 11, 2016 at 10:17:13 AM UTC+5:30, Stephen Hansen wrote: > > > On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > > > > and the (almost always to be

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Marko Rauhamaa
Terry Reedy : > On 4/10/2016 8:17 PM, Fillmore wrote: > >> apparently my 'discontinuity' is mappable to the fact that there's no >> such thing as one-element tuples in Python, and attempts to create >> one will result in a string (i.e. an object of a different kind!)... > > Please work through the

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 10:18 PM, Rustom Mody wrote: > On Monday, April 11, 2016 at 10:17:13 AM UTC+5:30, Stephen Hansen wrote: > > On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > > > and the (almost always to be avoided) use of eval() > > > > FWIW, there's ast.literal_eval which is safe and

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Rustom Mody
On Monday, April 11, 2016 at 10:17:13 AM UTC+5:30, Stephen Hansen wrote: > On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > > and the (almost always to be avoided) use of eval() > > FWIW, there's ast.literal_eval which is safe and there's no reason to > avoid it. Its error reporting is clunky

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > and the (almost always to be avoided) use of eval() FWIW, there's ast.literal_eval which is safe and there's no reason to avoid it. You'll still have to deal with the fact that a single string on a line will return a string while multiples will

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Fillmore
On 04/10/2016 11:54 PM, Steven D'Aprano wrote: On Mon, 11 Apr 2016 12:48 pm, Fillmore wrote: funny, but it seems to me that you are taking it personally... thank god i even apologized in advance for what was most probably a stupid question.. I hope you did get a laugh out of it, becau

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Steven D'Aprano
On Mon, 11 Apr 2016 12:48 pm, Fillmore wrote: > > funny, but it seems to me that you are taking it personally... thank god i > even apologized in advance for what was most probably a stupid question.. I hope you did get a laugh out of it, because it wasn't meant to be nasty. But i

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Fillmore
funny, but it seems to me that you are taking it personally... thank god i even apologized in advance for what was most probably a stupid question.. On 04/10/2016 09:50 PM, Steven D'Aprano wrote: Fillmore, you should feel very pleased with yourself. All the tens of thousands of P

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Chris Angelico
On Mon, Apr 11, 2016 at 12:22 PM, Dan Sommers wrote: > On Mon, 11 Apr 2016 01:33:10 +0100, MRAB wrote: > >> There _is_ one exception though: (). It's the empty tuple (a 0-element >> tuple). It doesn't have a comma and the parentheses are mandatory. >> There's no other way to write it. > > The othe

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Dan Sommers
On Mon, 11 Apr 2016 01:33:10 +0100, MRAB wrote: > There _is_ one exception though: (). It's the empty tuple (a 0-element > tuple). It doesn't have a comma and the parentheses are mandatory. > There's no other way to write it. The other way to write it is: tuple() -- https://mail.python.org/

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Steven D'Aprano
On Mon, 11 Apr 2016 08:51 am, Fillmore wrote: > at which point did the language designers decide to betray the > "path of least surprise" principle and create a 'discontinuity' in the > language? It was March 1996, and I was there. I don't remember the date, I'm afraid. Some of the core Python de

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Terry Reedy
On 4/10/2016 8:17 PM, Fillmore wrote: apparently my 'discontinuity' is mappable to the fact that there's no such thing as one-element tuples in Python, and attempts to create one will result in a string (i.e. an object of a different kind!)... Please work through the tutorial before posting wr

Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask])

2016-04-10 Thread Tim Chase
On 2016-04-11 10:45, Ben Finney wrote: > Also, there is another obvious way to create an empty tuple: call > the ‘tuple’ type directly: > > >>> foo = tuple() > >>> print(type(foo), len(foo)) > 0 But here the parens make the tuple too: >>> foo = tuple >>> print(type(foo))

Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask])

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:45 PM, Ben Finney wrote: > So, let's please stop saying “parens don't create a tuple”. They do, and > because of that I've stopped saying that false over-simplification. I stand by "parens don't make a tuple", with the caveat that I should have mentioned the empty tuple

Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask])

2016-04-10 Thread Chris Angelico
On Mon, Apr 11, 2016 at 10:45 AM, Ben Finney wrote: > So the expanation that remains true when you examine it is: People > wanted a literal syntax to create a zero-length tuple. A pair of parens > is that literal syntax, and it's the parens that create the (empty) > tuple. But parens do NOT creat

Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask])

2016-04-10 Thread Ben Finney
Stephen Hansen writes: > […] parens don't make tuples, commas do. Chris Angelico writes: > The thing you're confused at is that it's not the parentheses that > create a tuple. Parentheses merely group. MRAB writes: > As has been said already, it's the comma that makes the tuple. The > par

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Chris Angelico
On Mon, Apr 11, 2016 at 10:33 AM, MRAB wrote: > For example, object are passed into a function thus: > > f(x, y) > > (In reality, it's making a tuple and then passing that in.) Actually that's not the case; certain syntactic constructs allow you to specify multiple of something, without packa

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:17 PM, Fillmore wrote: > On 04/10/2016 07:30 PM, Stephen Hansen wrote: > > > There's nothing inconsistent or surprising going on besides you doing > > something vaguely weird and not really expressing what you find > > surprising. > > well, I was getting some surprisin

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Ben Finney
Fillmore writes: > Sorry guys. It was not my intention to piss off anyone...just trying > to understand how the languare works Frustration is understandable when learning something new :-) Hopefully that can be a signal to take a breath, and compose messages to minimise frustration for the reade

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread MRAB
On 2016-04-11 01:13, Fillmore wrote: Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works I guess that the answer to my question is: there is no such thing as a one-element tuple, and Python will automatically convert a one-element tuple to

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:22 PM, Fillmore wrote: > Hold on a sec! it turns up that there is such thing as single-element > tuples in python: > > >>> c = ('hello',) > >>> c > ('hello',) > >>> c[0] > 'hello' > >>> c[1] > Traceback (most recent call last): >File "", line 1, in > IndexError

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Chris Angelico
On Mon, Apr 11, 2016 at 10:13 AM, Fillmore wrote: > Sorry guys. It was not my intention to piss off anyone...just trying to > understand how the languare works > > I guess that the answer to my question is: there is no such thing as a > one-element tuple, > and Python will automatically convert a

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Fillmore
On 04/10/2016 08:13 PM, Fillmore wrote: Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works I guess that the answer to my question is: there is no such thing as a one-element tuple, and Python will automatically convert a one-element tuple

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Fillmore
On 04/10/2016 07:30 PM, Stephen Hansen wrote: There's nothing inconsistent or surprising going on besides you doing something vaguely weird and not really expressing what you find surprising. well, I was getting some surprising results for some of my data, so I can guarantee that I was surpris

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:18 PM, Stephen Hansen wrote: > The parens are optional, I always put them in because: > >>> b = "hello", Ahem, "because its easy to miss the trailing comma" is what I meant to say here. -- https://mail.python.org/mailman/listinfo/python-list

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:13 PM, Fillmore wrote: > I guess that the answer to my question is: there is no such thing as a > one-element tuple, > and Python will automatically convert a one-element tuple to a string... > hence the > behavior I observed is explained... > > >>> a = ('hello','bonjo

one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Fillmore
Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works I guess that the answer to my question is: there is no such thing as a one-element tuple, and Python will automatically convert a one-element tuple to a string... hence the behavior I obs

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 03:51 PM, Fillmore wrote: > > let's look at this: > > $ python3.4 > Python 3.4.0 (default, Apr 11 2014, 13:05:11) > [GCC 4.8.2] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> line1 = '"String1" | bla' > >>> parts1 = line1.split("

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Ben Finney
Fillmore writes: > let's look at this: Can you set a “Subject” field that pertains to the actual question? As is, it doesn't help know what you want to discuss. > the question is: at which point did the language designers decide to > betray the "path of least surprise" principle and create a >

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Chris Angelico
On Mon, Apr 11, 2016 at 8:51 AM, Fillmore wrote: > the question is: at which point did the language designers decide to betray > the > "path of least surprise" principle and create a 'discontinuity' in the > language? > Open to the idea that I am getting something fundamentally wrong. I'm new to >

Most probably a stupid question, but I still want to ask

2016-04-10 Thread Fillmore
let's look at this: $ python3.4 Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> line1 = '"String1" | bla' >>> parts1 = line1.split(" | ") >>> parts1 ['"String1"', 'bla'] >>> tokens1 = eval(parts1[0]) >>

Re: maybe a stupid question

2008-08-08 Thread Christian Heimes
Strato wrote: I have an app installed in /usr/lib/python2.5/site-package/MyApp I have a symlink in /usr/local/bin that points to /usr/lib/python2.5/site-package/MyApp/myscript.py Then, when I launch my script from anywhere using the symlink, how to determine that the script is located in /u

maybe a stupid question

2008-08-08 Thread Strato
Hi, I suppose this has already been asked in the list, but I ask anyway: I want to determine from where my python app is executed, but I want to determine the path of the real script file, not the path of the command being executed (in case of symlink in a *bin dir in the system). I explain:

Re: this must be a stupid question ...

2007-07-28 Thread Ben Finney
Stef Mientki <[EMAIL PROTECTED]> writes: > but I can;t find the answer ;-) It's not a stupid question, but it is a stupid Subject field. That's easy to fix though: in future, please write a Subject field that actually tells us what the message is about. > If I try to use [

Re: this must be a stupid question ...

2007-07-28 Thread Gary Herron
Stef Mientki wrote: > but I can;t find the answer ;-) > > As searching for the '$' sign doesn't work well in the help files, > I can not find out, where is the '$' sign used for. > > If I try to use it in names, > I get a compiler error, > so it probably has some special meaning. > > thanks, > Stef

Re: this must be a stupid question ...

2007-07-28 Thread David Wilson
On 28/07/07, Stef Mientki <[EMAIL PROTECTED]> wrote: > but I can;t find the answer ;-) > > As searching for the '$' sign doesn't work well in the help files, > I can not find out, where is the '$' sign used for. > > If I try to use it in names, > I get a compiler error, > so it probably has some sp

Re: this must be a stupid question ...

2007-07-28 Thread Neil Cerutti
On 2007-07-28, Stef Mientki <[EMAIL PROTECTED]> wrote: > but I can;t find the answer ;-) > > As searching for the '$' sign doesn't work well in the help > files, I can not find out, where is the '$' sign used for. > > If I try to use it in names, I get a compiler error, so it > probably has some sp

this must be a stupid question ...

2007-07-28 Thread Stef Mientki
but I can;t find the answer ;-) As searching for the '$' sign doesn't work well in the help files, I can not find out, where is the '$' sign used for. If I try to use it in names, I get a compiler error, so it probably has some special meaning. thanks, Stef Mientki -- http://mail.python.org/mai

Re: probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Carl Banks
Stef Mientki wrote: > Does anyone know the equivalent of the MatLab "diff" function. > The "diff" functions calculates the difference between 2 succeeding > elements of an array. > I need to detect (fast) the falling edge of a binary signal. Using numpy (or predecessors), you can do this easily wi

Re: probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Marcus Goldfish
There's derivate function in Python diff, but when you use an binary (true/false) input, it also detects rising edges. Probably a stupid question, but I still have troubles, digging to huge amount of information about Python. thanks, Stef Mientki -- http://mail.python.org/mailman/listin

Re: A stupid question

2006-12-29 Thread Matimus
[EMAIL PROTECTED] wrote: > Any other ideas? Well, you could always try downloading and installing python: http://www.python.org. It is completely free. It won't run anything in the task bar or add itself to the startup menu and it doesn't have ads... it just sits there waiting for you to use it. I

probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Stef Mientki
use an binary (true/false) input, it also detects rising edges. Probably a stupid question, but I still have troubles, digging to huge amount of information about Python. thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list

Re: A stupid question

2006-12-29 Thread luxnoctis
I knew what everything was for when I uninstalled it, I just didn't happen to know about every component part, apparently. ;) I have tried reinstalling the Bittorrent client, and to no avail. (The computer is a Toshiba Satellite laptop, if that helps anyone.) Any other ideas? Tom Plunket wrote: >

Re: A stupid question

2006-12-29 Thread Tom Plunket
luxnoctis wrote: > It says exactly: > > The specified module could not be found. > LoadLibrary(pythondll) failed > > Don't know if that helps at all. There's something installed on Compaq computers that uses the Python stuff too, but I never figured out what it was. I figured it may have been

Re: A stupid question

2006-12-28 Thread Gabriel Genellina
At Friday 29/12/2006 01:05, [EMAIL PROTECTED] wrote: The specified module could not be found. LoadLibrary(pythondll) failed For the bittorrent client, reinstalling it should be enough. For other issues on your system, best to contact your vendor. -- Gabriel Genellina Softlab SRL

Re: A stupid question

2006-12-28 Thread casevh
[EMAIL PROTECTED] wrote: > It says exactly: > > The specified module could not be found. > LoadLibrary(pythondll) failed > > >I bought a floor model computer, and it came with all sorts of > > >ridiculousness on it that I promptly uninstalled. However, now whenever > > >I start windows I get a me

Re: A stupid question

2006-12-28 Thread luxnoctis
It says exactly: The specified module could not be found. LoadLibrary(pythondll) failed Don't know if that helps at all. Gabriel Genellina wrote: > At Friday 29/12/2006 00:27, [EMAIL PROTECTED] wrote: > > >I bought a floor model computer, and it came with all sorts of > >ridiculousness on it tha

Re: A stupid question

2006-12-28 Thread Gabriel Genellina
At Friday 29/12/2006 00:27, [EMAIL PROTECTED] wrote: I bought a floor model computer, and it came with all sorts of ridiculousness on it that I promptly uninstalled. However, now whenever I start windows I get a message saying "LoadLibrary (pythondll ) failed." It also says this when I try to do

Re: A stupid question

2006-12-28 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hello all. Let me say first that I have no idea what python is or what > it does. > > I bought a floor model computer, and it came with all sorts of > ridiculousness on it that I promptly uninstalled. However, now whenever > I start windows I get a message saying "LoadLi

A stupid question

2006-12-28 Thread luxnoctis
Hello all. Let me say first that I have no idea what python is or what it does. I bought a floor model computer, and it came with all sorts of ridiculousness on it that I promptly uninstalled. However, now whenever I start windows I get a message saying "LoadLibrary (pythondll ) failed." It also s