Re: How to inverse a particle emitter

2015-06-04 Thread Gary Herron
On 06/04/2015 04:15 PM, stephenpprane...@gmail.com wrote: hey, i really need help, im a straight up beginner in scripting and i need to figure out how to make an inverted particle emitter using python in maya Python is a programming language. Maya is a modeling and animation application (or a

Re: Find in ipython3

2015-06-04 Thread Rustom Mody
On Friday, June 5, 2015 at 9:59:22 AM UTC+5:30, Cameron Simpson wrote: > On 04Jun2015 20:23, Michael Torrie wrote: > >On 06/04/2015 05:04 PM, Cameron Simpson wrote: > >> On 04Jun2015 13:09, Michael Torrie wrote: > >>> Why not use Python for what it's good for and say pipe the results of > >>> fin

Re: Find in ipython3

2015-06-04 Thread Cameron Simpson
On 04Jun2015 20:23, Michael Torrie wrote: On 06/04/2015 05:04 PM, Cameron Simpson wrote: On 04Jun2015 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. An

Re: Can Python function return multiple data?

2015-06-04 Thread Rustom Mody
On Friday, June 5, 2015 at 8:07:41 AM UTC+5:30, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 08:59 am, random832 wrote: > > > On Thu, Jun 4, 2015, at 18:16, Steven D'Aprano wrote: > >> Remember, you've tried to claim that it is not invisible or unknown, so > >> you > >> must be able to see and know

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 08:59 am, random...@fastmail.us wrote: > On Thu, Jun 4, 2015, at 18:16, Steven D'Aprano wrote: >> Remember, you've tried to claim that it is not invisible or unknown, so >> you >> must be able to see and know that value. So what is the value? > > It doesn't have to have a strin

Re: Find in ipython3

2015-06-04 Thread Michael Torrie
On 06/04/2015 05:04 PM, Cameron Simpson wrote: > On 04Jun2015 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. > > And several others made similar dis

Re: How to inverse a particle emitter

2015-06-04 Thread Michael Torrie
On 06/04/2015 05:47 PM, stephenpprane...@gmail.com wrote: > On Thursday, June 4, 2015 at 4:15:29 PM UTC-7, stephenp...@gmail.com wrote: >> hey, i really need help, im a straight up beginner in scripting and i need >> to figure out how to make an inverted particle emitter using python in maya > >

Re: Can Python function return multiple data?

2015-06-04 Thread Rustom Mody
On Friday, June 5, 2015 at 3:46:47 AM UTC+5:30, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 03:26 am, random832 wrote: > > If the value really were 23, the "is vs ==" problem wouldn't exist. > > What "problem"? "is versus ==" is not a problem, it is a feature. The two > operators do two different

Re: Can Python function return multiple data?

2015-06-04 Thread Grant Edwards
On 2015-06-04, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 04:38 am, Grant Edwards wrote: > But, discussing pass-by-this vs. pass-by-that without also discussing the semantics of the assignment operator is rather pointless. >>> >>> No, that's a red-herring. >> >> I don't think so. ??The

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 11:40 am, Mark Lawrence wrote: > On 05/06/2015 01:16, BartC wrote: >> On 05/06/2015 00:13, Steven D'Aprano wrote: >>> On Fri, 5 Jun 2015 06:52 am, BartC wrote: >>> On 04/06/2015 18:11, Steven D'Aprano wrote: > If there is > any language where assignment uses on

Re: Can Python function return multiple data?

2015-06-04 Thread Mark Lawrence
On 05/06/2015 01:16, BartC wrote: On 05/06/2015 00:13, Steven D'Aprano wrote: On Fri, 5 Jun 2015 06:52 am, BartC wrote: On 04/06/2015 18:11, Steven D'Aprano wrote: If there is any language where assignment uses one style and argument passing always uses another, I've never come across it.

Re: How to inverse a particle emitter

2015-06-04 Thread Ian Kelly
On Thu, Jun 4, 2015 at 5:47 PM, wrote: > On Thursday, June 4, 2015 at 4:15:29 PM UTC-7, stephenp...@gmail.com wrote: >> hey, i really need help, im a straight up beginner in scripting and i need >> to figure out how to make an inverted particle emitter using python in maya > > unfortunitly i hav

Re: Can Python function return multiple data?

2015-06-04 Thread BartC
On 05/06/2015 00:13, Steven D'Aprano wrote: On Fri, 5 Jun 2015 06:52 am, BartC wrote: On 04/06/2015 18:11, Steven D'Aprano wrote: If there is any language where assignment uses one style and argument passing always uses another, I've never come across it. My language does that. I'd be very

Re: How to inverse a particle emitter

2015-06-04 Thread stephenppraneel7
On Thursday, June 4, 2015 at 4:15:29 PM UTC-7, stephenp...@gmail.com wrote: > hey, i really need help, im a straight up beginner in scripting and i need to > figure out how to make an inverted particle emitter using python in maya unfortunitly i have to make this using python not mel -- https://

Re: How to inverse a particle emitter

2015-06-04 Thread Ian Kelly
On Thu, Jun 4, 2015 at 5:15 PM, wrote: > hey, i really need help, im a straight up beginner in scripting and i need to > figure out how to make an inverted particle emitter using python in maya No idea. This sounds more like a Maya question than a Python question. Maybe there is a Maya forum th

Re: How to inverse a particle emitter

2015-06-04 Thread Rob Gaddi
On Thu, 04 Jun 2015 16:15:20 -0700, stephenppraneel7 wrote: > hey, i really need help, im a straight up beginner in scripting and i > need to figure out how to make an inverted particle emitter using python > in maya This is why we can't have nice large hadron colliders. -- Rob Gaddi, Highland

How to inverse a particle emitter

2015-06-04 Thread stephenppraneel7
hey, i really need help, im a straight up beginner in scripting and i need to figure out how to make an inverted particle emitter using python in maya -- https://mail.python.org/mailman/listinfo/python-list

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 06:52 am, BartC wrote: > On 04/06/2015 18:11, Steven D'Aprano wrote: > >>If there is >> any language where assignment uses one style and argument passing always >> uses another, I've never come across it. > > My language does that. I'd be very surprised if it was the only one

Re: Find in ipython3

2015-06-04 Thread Cameron Simpson
On 04Jun2015 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. And several others made similar disparaging remarks. I think you're all missing some of the p

Re: Can Python function return multiple data?

2015-06-04 Thread Chris Angelico
On Fri, Jun 5, 2015 at 8:52 AM, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 04:38 am, Grant Edwards wrote: > But, discussing pass-by-this vs. pass-by-that without also discussing the semantics of the assignment operator is rather pointless. >>> >>> No, that's a red-herring. >> >> I don't

Re: Can Python function return multiple data?

2015-06-04 Thread random832
On Thu, Jun 4, 2015, at 18:16, Steven D'Aprano wrote: > Remember, you've tried to claim that it is not invisible or unknown, so > you > must be able to see and know that value. So what is the value? It doesn't have to have a string representation to exist. But if you really want one? >>> object._

Re: Multiple thread program problem

2015-06-04 Thread Cameron Simpson
On 04Jun2015 10:20, M2 wrote: Awesome Cameron. It works the way I want it to work. Glad to hear it. A few small remarks: Thanks a lot guys. Here is the new code: [...] from thread import start_new_thread You're not using this any more. You may want to tidy this up. def proc(col) :

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 04:38 am, Grant Edwards wrote: >>> But, discussing pass-by-this vs. pass-by-that without also discussing >>> the semantics of the assignment operator is rather pointless. >> >> No, that's a red-herring. > > I don't think so.  The reason that many people seem to confused about >

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 04:17 am, Alain Ketterlin wrote: > Steven D'Aprano writes: > > [...] >> 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

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 03:30 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >>> On 2015-06-04, Marko Rauhamaa wrote: If it prints 1, it's pass by value. If it prints 3, it's pass by reference. >> >> Wrong. Why do you [Marko] imagine that pass-by-value and >> pass-by-reference are the only

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 03:30 am, random...@fastmail.us wrote: > On Thu, Jun 4, 2015, at 13:11, Steven D'Aprano wrote: >> You need at least one more test to prove pass by value: you need to >> demonstrate that the value bound to y is copied when passed to the >> function. E.g. pass a mutable value (say

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 03:26 am, random...@fastmail.us wrote: > On Thu, Jun 4, 2015, at 09:47, Steven D'Aprano wrote: >> In other words, according to this Java philosophy, following `x = 23`, >> the >> value of x is not 23 like any sane person would expect, but some >> invisible >> and unknown, and un

Re: Calling Python Script from an SQL Proceudre

2015-06-04 Thread Chris Angelico
On Fri, Jun 5, 2015 at 12:02 AM, Amit Goutham wrote: > Hi Laura, > Thanks a Lot for the reply. > I wanted to know if calling a Python script from SAP HANA database is > possible. What you're asking for there is a SAP HANA feature, not a Python one. You could possibly ask SAP about it, but based o

Re: Can Python function return multiple data?

2015-06-04 Thread Chris Angelico
On Fri, Jun 5, 2015 at 3:11 AM, Steven D'Aprano wrote: > You need at least one more test to prove pass by value: you need to > demonstrate that the value bound to y is copied when passed to the > function. E.g. pass a mutable value (say, a list) and mutate it inside the > function. If the list in

Re: Can Python function return multiple data?

2015-06-04 Thread BartC
On 04/06/2015 18:11, Steven D'Aprano wrote: If there is any language where assignment uses one style and argument passing always uses another, I've never come across it. My language does that. I'd be very surprised if it was the only one in existence that does so. Assignments involve a deep

Re: Find in ipython3

2015-06-04 Thread random832
On Tue, Jun 2, 2015, at 12:13, 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? Python really isn't a good substitute for a shell, but the normal python

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 -- h

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 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 expected the "pass by value"

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 wri

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 myri

Re: Can Python function return multiple data?

2015-06-04 Thread Grant Edwards
On 2015-06-04, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 12:37 am, Grant Edwards wrote: >> On 2015-06-04, Marko Rauhamaa wrote: > >>> 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 >>>

Re: Can Python function return multiple data?

2015-06-04 Thread Ian Kelly
On Wed, Jun 3, 2015 at 3:56 PM, Mark Lawrence 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. -- https://mail.python.org/mailman/listinfo/python-list

Re: Can Python function return multiple data?

2015-06-04 Thread Alain Ketterlin
Steven D'Aprano writes: [...] > 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". I find this clear a

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Well... I must say I am impressed: Python parsers the file/info I want in just: Seconds: 0.013389648 For +/- 20.000 lines of input data/text. This makes it very usuable cool ! Now I try the bigger file: +/- 285.000 lines of input data/text: Seconds: 0.092351501 Very impressive ! I

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Ok problem found. The data contains: EntityRef EntityRef So perhaps I screwed it up or perhaps the data is a bit bad. I ll check on my web drive: http://www.skybuck.org/Games/StartrekOnline/Parser/SpaceFleetAlertEnemyExample.demo Firefox doesn't find it... so apperently I fucked up data a b

Re: Can Python function return multiple data?

2015-06-04 Thread random832
On Thu, Jun 4, 2015, at 13:36, Michael Torrie wrote: > Surely two objects can hold the same value, or represent the same value > (number), without *having* to be the same object. I don't see why > people would assume, let alone demand that different objects > representing the same value be the sam

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Something strange happens with: 36044817 near the update section... for some reason it doesn't copy it properly... Hmm... Maybe a bug in output or an additional new line or maybe something wrong... Hmm.. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
I feel my conclusion is a bit hasty... but using dictionaries is not easy that for sure. Apperently the problem is DemoEntityInde is none ? But why would it be none ? Hmmm strange... maybe some refs are not in there... hmmm... Yeah could be... I cutted some stuff out... so I better check for

Re: Can Python function return multiple data?

2015-06-04 Thread Michael Torrie
On 06/04/2015 11:26 AM, random...@fastmail.us wrote: > Of course, in CPython, the type of an object reference is PyObject *. > Which isn't invisible, unknown, or unknowable, either. > > If the value really were 23, the "is vs ==" problem wouldn't exist. Surely two objects can hold the same value,

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
get was tried but now new error somewhere else: [error] TypeError ( list indices must be integers ) [error] --- Traceback --- error source first line: module ( function ) statement 133: main ( ProcessUpdateEntityDead ) DemoEntityDead[DemoEntityIndex] = Dead Apperently the returned index from

Re: Can Python function return multiple data?

2015-06-04 Thread Marko Rauhamaa
Steven D'Aprano : >> On 2015-06-04, Marko Rauhamaa wrote: >>> If it prints 1, it's pass by value. If it prints 3, it's pass by >>> reference. > > Wrong. Why do you [Marko] imagine that pass-by-value and > pass-by-reference are the only two options? It's a classic dichotomy. The example I provide

Re: Can Python function return multiple data?

2015-06-04 Thread random832
On Thu, Jun 4, 2015, at 13:11, Steven D'Aprano wrote: > You need at least one more test to prove pass by value: you need to > demonstrate that the value bound to y is copied when passed to the > function. E.g. pass a mutable value (say, a list) and mutate it inside > the > function. If the list in

Re: Can Python function return multiple data?

2015-06-04 Thread random832
On Thu, Jun 4, 2015, at 09:47, Steven D'Aprano wrote: > In other words, according to this Java philosophy, following `x = 23`, > the > value of x is not 23 like any sane person would expect, but some > invisible > and unknown, and unknowable, reference to 23. Well, no, because, in Java, if the typ

Re: Parser needed.

2015-06-04 Thread Michael Torrie
On 06/04/2015 11:14 AM, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 03:02 am, Skybuck Flying wrote: > >> Yeah... my first nice parser for this kind of stuff... >> >> Python is really nice for this stuff... >> >> Piece a cake.. now I just need to stuff it in some dictionary and I am >> done or so ;

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Very nice code almost done. Now I am trying to do the code correctly and fast, thus using a dictionary, but I run into a little problem: The dictionary is declared as: DemoEntityRefIndex = {} Pairs are added as: DemoEntityRefIndex[Ref] = DemoEntityIndex And now I try to retrieve the demo e

Re: Multiple thread program problem

2015-06-04 Thread M2
On Wednesday, June 3, 2015 at 3:41:15 PM UTC-5, M2 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

Re: Parser needed.

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 03:02 am, Skybuck Flying wrote: > Yeah... my first nice parser for this kind of stuff... > > Python is really nice for this stuff... > > Piece a cake.. now I just need to stuff it in some dictionary and I am > done or so ;) > > Though a dictionary might be hard to traverse in

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 12:37 am, Grant Edwards wrote: > On 2015-06-04, Marko Rauhamaa wrote: >> 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

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Yeah... my first nice parser for this kind of stuff... Python is really nice for this stuff... Piece a cake.. now I just need to stuff it in some dictionary and I am done or so ;) Though a dictionary might be hard to traverse in sequence... A list is probably enough... assuming no duplicate

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Yes these string processing techniques will work very nicely and very fast: cut and pasted an example but should work... now I developed it a bit further, bye ,bye. BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic Studios\\Star Trek Online\\Live\\demos" BotDemoFile = "Sp

Re: Find in ipython3

2015-06-04 Thread Cecil Westerhof
Op Thursday 4 Jun 2015 16:27 CEST schreef Grant Edwards: > On 2015-06-04, Cecil Westerhof wrote: >> Op Thursday 4 Jun 2015 04:54 CEST schreef Cameron Simpson: >> >>> On 02Jun2015 18:13, Cecil Westerhof wrote: I am thinking about using ipython3 instead of bash. When I want to find a fil

Re: Can Python function return multiple data?

2015-06-04 Thread ElChino
Steven D'Aprano wrote: > 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". To quote Niklaus Wirth (the fa

Re: Can Python function return multiple data?

2015-06-04 Thread Marko Rauhamaa
Grant Edwards : >> 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: Can Python function return multiple data?

2015-06-04 Thread Grant Edwards
On 2015-06-04, Marko Rauhamaa wrote: > Steven D'Aprano : > >> 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

Re: Find in ipython3

2015-06-04 Thread Grant Edwards
On 2015-06-04, Cecil Westerhof wrote: > Op Thursday 4 Jun 2015 04:54 CEST schreef Cameron Simpson: > >> On 02Jun2015 18:13, 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' >>> b

Re: Can Python function return multiple data?

2015-06-04 Thread Marko Rauhamaa
Steven D'Aprano : > 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 terminology? Definitio

Re: Regular Expression

2015-06-04 Thread Laura Creighton
In a message of Thu, 04 Jun 2015 06:36:29 -0700, Palpandi writes: >Hi All, > >This is the case. To split "string2" from "string1_string2" I am using >re.split('_', "string1_string2", 1) And you shouldn't be. The 3rd argument, 1 says stop after one match. >It is working fine for string "string1_

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 w

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

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 03:26 am, BartC asked about Value and Object: > Are they in fact the same, or is there something else that can be done > more reliably to show the difference? In *Python*, they are the same. All values are implemented as objects. But, speaking generically, Value and Object are

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" wrote: > In a message of Wed, 03 Jun 2015 15:17:16 +0530, Amit Goutham writes: > >Hi All, > >I am trying to search on the Intern

Re: Regular Expression

2015-06-04 Thread Peter Otten
Palpandi wrote: > 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

Re: Regular Expression

2015-06-04 Thread Tim Chase
On 2015-06-04 06:36, Palpandi wrote: > 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

Re: Regular Expression

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 11:36 pm, Palpandi wrote: > Hi All, > > This is the case. To split "string2" from "string1_string2" I am using > re.split('_', "string1_string2", 1)[1]. There is absolutely no need to use the nuclear-powered bulldozer of regular expressions to crack that tiny peanut. Strings

Re: Can Python function return multiple data?

2015-06-04 Thread Steven D'Aprano
On Thu, 4 Jun 2015 08:28 am, sohcahto...@gmail.com wrote: > On Wednesday, June 3, 2015 at 2:57:00 PM UTC-7, Mark Lawrence 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. > Peop

Re: Regular Expression

2015-06-04 Thread Larry Martell
On Thu, Jun 4, 2015 at 9:36 AM, Palpandi 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 sti

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() > >

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

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 g

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, all

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.) https://docs.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 n

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,

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, widt

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: 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 >

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

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 us

Re: Argument Presence Checking via Identity or Boolean Operation?

2015-06-04 Thread Ben Finney
Russell Brennan 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 Pythonic way to test

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: http://www.electricmonk.nl/log/2011/09/06/creating-simple-debian-packag

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 doThis(arg1

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: 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 "

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 it