Re: SOAPpy: Expected to find node type 'Element' with name 'CountriesFetchingRequest'; Found node type 'Element' with name 'FetchCountries'

2014-09-23 Thread Veek M
dieter wrote: I have no experience with SOAPpy, but with suds (another Python SAOP client). A suds client exposes two attributes factory *miaows happily* -- https://mail.python.org/mailman/listinfo/python-list

Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
https://github.com/Veek/Python/tree/master/junk/hello doesn't work. I have: hello.c which contains: int hello(void); hello.h To wrap that up, i have: hello.py - _hello (c extension) - pyhello.c - method py_hello() People using this will do: python3.2 import hello python3.2 hello.hello() It

Re: generating unique variable name via loops

2014-11-04 Thread Veek M
Fatih Güven wrote: 4 Kas?m 2014 Sal? 13:29:34 UTC+2 tarihinde Fatih Güven yazd?: I want to generate a unique variable name for list using python. list1=... list2=... for x in range(1,10): exec(list%d = [] % x) -- https://mail.python.org/mailman/listinfo/python-list

Re: generating unique variable name via loops

2014-11-04 Thread Veek M
Fatih Güven wrote: This is okay but i can't use the method .append for example list1.append(abc) works for me -- https://mail.python.org/mailman/listinfo/python-list

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
Søren wrote: import ctypes Hi, yeah i kind of liked it - still reading the docs though, Beazley has the Python.h solution so I though I'd try that first. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
Jason Swails wrote: I've submitted a PR to your github repo showing you the changes necessary to get your module working on my computer. Segfaults :p which is an improvement :) open(./_hello.cpython-32mu.so, O_RDONLY) = 5 read(5,

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
Jason Swails wrote: What operating system are you running this on? It works fine for me on Linux: Wheezy Debian, Linux deathstar 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux gcc (Debian 4.7.2-5) 4.7.2 Python 3.2.3 I ran it through gdb - not very useful: (gdb) bt #0

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
static PyMethodDef hellomethods[] = { {hello, py_hello, METH_VARARGS, py_hello_doc}, {NULL, NULL, 0, NULL}, }; It's basically the METH_VARARGS field that's giving the problem. Switching it to NULL gives, SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Veek M
okay got it working - thanks Jason! The 3.2 docs are slightly different. -- https://mail.python.org/mailman/listinfo/python-list

Python, VIM: namespace, scope, life of a python object stuck in a HERE

2014-11-04 Thread Veek M
If i have two functions: function! foo() python3 HERE import mylib pass HERE function! bar() python3 HERE import mylib pass HERE The src says: 1. Python interpreter main program 3. Implementation of the Vim module for Python So, is the python interpreter embedded in vim AND

How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-07 Thread Veek M
def jump_to_blockD(self): end = len(self.b) row, col = self.w.cursor while row = end: try: new_col = self.b[row].index('def') self.w.cursor = row, new_col break except ValueError:

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-07 Thread Veek M
Veek M wrote: new_col = self.b[row].index('def') self.w.cursor = row, new_col new_col = self.b[row].rindex('def') self.w.cursor = row, new_col There's also the different methods index vs rindex. Does this sort of thing

Re: How do i reduce this to a single function - the code is largely similar, just a direction of search toggle.

2014-11-09 Thread Veek M
Ned Batchelder wrote: On 11/7/14 9:52 AM, Veek M wrote: and you want to end up on the def token, not the def in yep, bumped into this :) thanks! -- https://mail.python.org/mailman/listinfo/python-list

functools documentation - help with funny words

2014-11-09 Thread Veek M
https://docs.python.org/3.4/library/functools.html 1. A key function is a callable that accepts one argument and returns another value indicating the position in the desired collation sequence. x = ['x','z','q']; sort(key=str.upper) My understanding is that, x, y, .. are passed to the key

Python: package root, root-node, __init__.py in the package root

2014-11-13 Thread Veek M
I have a package structured like so on the file system: PKG LIBS are stored here: /usr/lib/python3.2/ Pkg-name: foo-1.0.0 1. What is the root directory, or root-node or 'root' of my package? My understanding is that it's: /usr/lib/python3.2/foo-1.0.0/ on the file-system and this is referred to

Python 3.x (beazley): __context__ vs __cause__ attributes in exception handling

2014-11-13 Thread Veek M
In 'Chained Exceptions' - Beazley pg:626 try: pass except ValueError as e: raise SyntaxError('foo bar') from e - Here, if ValueError is raised and SyntaxError is then raised.. 'e' contains __cause__ which points to the ValueError Traceback. He goes on to say:

Re: Python 3.x (beazley): __context__ vs __cause__ attributes in exception handling

2014-11-14 Thread Veek M
It's been answered here: http://stackoverflow.com/questions/26924045/python-3-x-beazley-context-vs- cause-attributes-in-exception-handling?noredirect=1#comment42403467_26924045 -- https://mail.python.org/mailman/listinfo/python-list

uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-16 Thread Veek M
Has anyone got the thing to work? I want to run some python database scripts on nginx. Because that will have a simple web-UI, i decided to go with uWSGI. It's proving to be a massive pain. I found a decent book for nginx and got that bit working. The query gets sent to uWSGI but for some

Re: uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-16 Thread Veek M
Chris Warrick wrote: This is NOT how uwsgi works! You cannot use plain .py files with it, and for good reason ? CGI should be long dead. What you need to do is, you must write a webapp ? in Flask, for example. Then you must craft an .ini file that mentions this. **Hi Chris, Could you

Re: uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-16 Thread Veek M
Just to be very very clear about this: 1. I have never worked seriously with Javascript, frameworks, django, flask etc. 2. I can write CGI on Apache. 3. I have never worked with nginx untill 2 days ago. 4. All this started because I wanted to mess with SQL/CSS/HTML5. 5. Some frigging! *moron* on

Re: uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-16 Thread Veek M
http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12 -- https://mail.python.org/mailman/listinfo/python-list

Re: uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-17 Thread Veek M
Dumped uwsgi - the documentation is utterly ridculous!! Switched to 'Bottle' - very nice, intutive and clean - tutorial+documentation is excellent and i got 'hello world' up and running in like 10-15 minutes vs the 2 days intermittent it took to scroll through the crap that is uwsgi-server.

Google Maps and Python: creating a map, embedding it, adding images, videos, markers, using python

2014-12-18 Thread Veek M
I'm messing with Google-Maps. Is there a way I can create a map, embed it on a page (CSS/HTML/Javascript for this bit), and add images, videos, markers - using python? Any libraries available? -- https://mail.python.org/mailman/listinfo/python-list

Re: Javascript website scraping using WebKit and Selenium tools

2015-07-02 Thread Veek M
dieter wrote: Once the problems to get the final HTML code solved, I would use lxml and its xpath support to locate any relevant HTML information. Hello Dieter, yes - you are correct. (though I don't think there's any auth to browse - nice that you actually tried) He's using jsonP and

Re: lxml.xpath 'for/xpath' to get to a node and then xpath again within the loop?

2015-07-02 Thread Veek M
never mind fixed.. it's returning a list so whatever[0].text and relative-path for the xpath -- https://mail.python.org/mailman/listinfo/python-list

lxml.xpath 'for/xpath' to get to a node and then xpath again within the loop?

2015-07-02 Thread Veek M
I travel to 'item-name', how do i quickly travel to c-price and then print both values of text. I tried: for anchor in element.xpath('//a[@class=item-name]'): #Travel to item-name but when i getparent and then call xpath I get a whole bunch of span elements as a list - why? Shouldn't xpath

Re: lxml.xpath 'for/xpath' to get to a node and then xpath again within the loop?

2015-07-06 Thread Veek M
Saran Ahluwalia wrote: So what did you do to resolve this? Please provide your fix. This is an excellent case study for others. it's provided, what part didn't you understand? Try googling relative-path, wth? -- https://mail.python.org/mailman/listinfo/python-list

Re: requests.Session() how do you set 'replace' on the encoding?

2015-07-06 Thread Veek M
dieter wrote: Veek M vek.m1...@gmail.com writes: UnicodeEncodeError: 'gbk' codec can't encode character u'\xa0' in position 8: illegal multibyte sequence You give us very little context. It's a longish chunk of code: basically, i'm trying to download using the 'requests.Session' module

requests.Session() how do you set 'replace' on the encoding?

2015-07-02 Thread Veek M
I'm getting a Unicode error: Traceback (most recent call last): File fooxxx.py, line 56, in module parent = anchor.getparent() UnicodeEncodeError: 'gbk' codec can't encode character u'\xa0' in position 8: illegal multibyte sequence I'm doing: s = requests.Session() to suck data in, so..

Javascript website scraping using WebKit and Selenium tools

2015-07-01 Thread Veek M
I tried scraping a javascript website using two tools, both didn't work. The website link is: http://xdguo.taobao.com/category-499399872.htm The relevant text I'm trying to extract is 'GY-68...': div class=item3line1 dl class=item data-id=38952795780 dt class=photo a

Re: requests.Session() how do you set 'replace' on the encoding?

2015-07-09 Thread Veek M
dieter wrote: It looks strange that you can set s.encoding after you have called s.get - but, as you apparently get an error related to the gbk encoding, it seems to work. Ooo! Sorry, typo - that was outside the function but before the call. Unfortunately whilst improving my function for

Re: lxml.xpath 'for/xpath' to get to a node and then xpath again within the loop?

2015-07-09 Thread Veek M
Mark Lawrence wrote: If it's provided why have you snipped it this time around? May I most humbly suggest that the next time you ask, please ensure that you tell us what you've googled for prior to putting your question. umm.. I can't determine what you mean by 'snipped it'. 1. I posted a

coroutine, throw, yield, call-stack and exception handling

2016-02-08 Thread Veek. M
Exceptions can be raised inside a coroutine using the throw( Exceptions raised in this manner will originate at the currently executing yield state-ment in the coroutine.A coroutine can elect to catch exceptions and handle them as appropriate. It is not safe to use

Re: coroutine, throw, yield, call-stack and exception handling

2016-02-08 Thread Veek. M
Veek. M wrote: > > Exceptions can be raised inside a coroutine using the throw( > > Exceptions raised in this manner will originate at the currently > executing yield state-ment in the coroutine.A coroutine can elect to > catch exceptio

Re: coroutine, throw, yield, call-stack and exception handling

2016-02-09 Thread Veek. M
Ian Kelly wrote: > On Mon, Feb 8, 2016 at 2:17 AM, Veek. M <vek.m1...@gmail.com> wrote: >> >> Exceptions can be raised inside a coroutine using the throw( >> >> Exceptions raised in this manner will originate at the curren

Re: x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-01-31 Thread Veek. M
Thanks guys: you've given me some good ideas - I really need to re-read the lxml docs for xpath. (basically trying to scrape ebay and score a mobo - ebaysdk doesn't work) Also need to google those principles :) thanks! (i knew one shouldn't overly rely on chained attribute lookups - didn't

Re: x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-01-30 Thread Veek. M
Chris Angelico wrote: > On Sun, Jan 31, 2016 at 3:58 PM, Veek. M <vek.m1...@gmail.com> wrote: >> I'm parsing html and i'm doing: >> >> x = root.find_class(... >> y = root.find_class(.. >> z = root.find_class(.. >> >> all 3 are likely

Re: x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-01-30 Thread Veek. M
Veek. M wrote: > Chris Angelico wrote: > >> On Sun, Jan 31, 2016 at 3:58 PM, Veek. M <vek.m1...@gmail.com> wrote: >>> I'm parsing html and i'm doing: >>> >>> x = root.find_class(... >>> y = root.find_class(.. >>> z = root.find_

x=something, y=somethinelse and z=crud all likely to fail - how do i wrap them up

2016-01-30 Thread Veek. M
I'm parsing html and i'm doing: x = root.find_class(... y = root.find_class(.. z = root.find_class(.. all 3 are likely to fail so typically i'd have to stick it in a try. This is a huge pain for obvious reasons. try: except something: x = 'default_1' (repeat 3 times) Is there some

Lookahead while doing: for line in fh.readlines():

2016-02-27 Thread Veek. M
I want to do something like: #!/usr/bin/env python3 fh = open('/etc/motd') for line in fh.readlines(): print(fh.tell()) why doesn't this work as expected.. fh.readlines() should return a generator object and fh.tell() ought to start at 0 first. Instead i get the final count repeated for

repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Veek. M
When I do at the interpreter prompt, repr( open('/etc/motd', 'rt').read() ) i get # 1 #: "'\\nThe programs included with the Debian GNU/Linux system are free software;\\nthe exact distribution terms for each program are described in the\\nindividual files in

threading - Doug Hellman stdlib book, Timer() subclassing etc

2016-02-16 Thread Veek. M
In Doug Hellman's book on the stdlib, he does: import threading import logging logging.basicConfig(level=logging.DEBUG, format=’(%(threadName)-10s) %(message)s’, ) class MyThreadWithArgs(threading.Thread): def __init__(self, group=None, target=None, name=None, args=(),

How do i instantiate a class_name passed via cmd line

2016-02-13 Thread Veek. M
I'm writing a price parser. I need to do the equivalent of perl's $$var to instantiate a class where $car is the class_name. I'm passing 'Ebay' or 'Newegg' or 'Amazon' via cmd-line. I have a module named ebay.py and a class called Ebay (price parser). I do something like: \> main.py ebay

Re: How do i instantiate a class_name passed via cmd line

2016-02-13 Thread Veek. M
Gregory Ewing wrote: > Veek. M wrote: >> I'm writing a price parser. I need to do the equivalent of perl's >> $$var to instantiate a class where $car is the class_name. >> >> I'm passing 'Ebay' or 'Newegg' or 'Amazon' via cmd-line. I have a >> module named ebay.

Re: How do i instantiate a class_name passed via cmd line

2016-02-13 Thread Veek. M
Rick Johnson wrote: > On Saturday, February 13, 2016 at 10:41:20 PM UTC-6, Veek. M wrote: >> how do i replace the 'Ebay' bit with a variable so that I >> can load any class via cmd line. > > Is this what you're trying to do? > > (Python2.x code) >>>&g

Descriptors vs Property

2016-03-11 Thread Veek. M
A property uses the @property decorator and has @foo.setter @foo.deleter. A descriptor follows the descriptor protocol and implements the __get__ __set__ __delete__ methods. But they both do essentially the same thing, allow us to do: foo = 10 del foo x = foo So why do we have two ways of

exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
What is the return value of `exec`? Would that object be then used to iterate the sequence in 'a'? I'm reading this: https://www.python.org/download/releases/2.2.3/descrintro/ -- https://mail.python.org/mailman/listinfo/python-list

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Steven D'Aprano wrote: > On Wednesday 09 March 2016 16:27, Veek. M wrote: > >> What is the return value of `exec`? Would that object be then used to >> iterate the sequence in 'a'? I'm reading this: >> https://www.python.org/download/releases/2.2.3/descrintro/ >

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Ben Finney wrote: > "Veek. M" <vek.m1...@gmail.com> writes: > >> What is the return value of `exec`? > > You can refer to the documentation for questions like that. > <URL:https://docs.python.org/3/library/functions.html#exec> > >> Wo

Re: Descriptors vs Property

2016-03-11 Thread Veek. M
Ian Kelly wrote: > On Fri, Mar 11, 2016 at 10:59 PM, Veek. M <vek.m1...@gmail.com> wrote: >> A property uses the @property decorator and has @foo.setter >> @foo.deleter. >> >> A descriptor follows the descriptor protocol and implements the >

Re: Descriptors vs Property

2016-03-11 Thread Veek. M
Veek. M wrote: > A property uses the @property decorator and has @foo.setter > @foo.deleter. > > A descriptor follows the descriptor protocol and implements the > __get__ __set__ __delete__ methods. > > But they both do essentially the same thing, allow us to do: > foo

Re: Descriptors vs Property

2016-03-13 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: > Veek. M wrote: > >> Thomas 'PointedEars' Lahn wrote: >>>> I haven't read the descriptor protocol as yet. >>> You should. You should also trim your quotations to the relevant >>> minimum, and post using your real na

Re: Pickle __getstate__ __setstate__ and restoring n/w - beazley pg 172

2016-03-09 Thread Veek. M
Ian Kelly wrote: > On Wed, Mar 9, 2016 at 2:14 AM, Veek. M <vek.m1...@gmail.com> wrote: >> what i wanted to know was, x = Client('192.168.0.1') will create an >> object 'x' with the IP inside it. When I do: >> pickle.dump(x) >> pickle doesn't know where in th

Re: Descriptors vs Property

2016-03-13 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: >>> Nobility lies in action, not in name. >>> —Surak Someone called Ned.B who i know elsewhere spoke on your behalf. I'm glad to say I like/trust Ned a bit so *huggles* to you, and I shall snip. Also, sorry about the 'Steve' thing - bit shady dragging in

Re: Descriptors vs Property

2016-03-12 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: >> I haven't read the descriptor protocol as yet. > > You should. You should also trim your quotations to the relevant > minimum, and post using your real name. > I don't take advice from people on USENET who DON'T have a long history of helping ME - unless

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-07 Thread Veek. M
Steven D'Aprano wrote: > On Monday 07 March 2016 17:13, Veek. M wrote: > >> import foo >> class Bar(object): >> def __del__(self, foo=foo): >> foo.bar()# Use something in module foo >> >> ### Why the foo=foo? import foo, would increment

Pickle __getstate__ __setstate__ and restoring n/w - beazley pg 172

2016-03-07 Thread Veek. M
import socket class Client(object): def __init__(self,addr): self.server_addr = addr self.sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) self.sock.connect(addr) def __getstate__(self): return self.server_addr def __setstate__(self,value): self.server_addr = value

Re: Lookahead while doing: for line in fh.readlines():

2016-03-04 Thread Veek. M
Terry Reedy wrote: > On 2/27/2016 4:39 AM, Veek. M wrote: >> I want to do something like: >> >> #!/usr/bin/env python3 >> >> fh = open('/etc/motd') >> for line in fh.readlines(): >> print(fh.tell()) >> >> why doesn't this work as expe

__del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
1. What are the rules for using __del__ besides: 'don't use it'. 2. What happens when I SystemExit? __del__ and gc are not invoked when I SystemExit and there's a circular reference - but why? The OS is going to reclaim the memory anyways so why be finicky about circular references - why can't

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
Veek. M wrote: > 1. What are the rules for using __del__ besides: 'don't use it'. > > 2. What happens when I SystemExit? __del__ and gc are not invoked when > I SystemExit and there's a circular reference - but why? The OS is > going to reclaim the memory anyways so why be finicky

Re: Lookahead while doing: for line in fh.readlines():

2016-03-04 Thread Veek. M
MRAB wrote: > On 2016-03-04 13:04, Veek. M wrote: >> Terry Reedy wrote: >> >>> On 2/27/2016 4:39 AM, Veek. M wrote: >>>> I want to do something like: >>>> >>>> #!/usr/bin/env python3 >>>> >>>> fh = open('/etc/motd

Re: Pickle __getstate__ __setstate__ and restoring n/w - beazley pg 172

2016-03-09 Thread Veek. M
dieter wrote: > "Veek. M" <vek.m1...@gmail.com> writes: > >> import socket >> class Client(object): >> def __init__(self,addr): >> self.server_addr = addr >> self.sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) >> self.soc

Scapy: sniff(filter='icmp', iface='ppp0', prn=icmp_callback)

2016-07-14 Thread Veek. M
#!/usr/bin/python import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import TCP, IP, ICMP, sniff def ip_callback(pkt): print '--- IP--' pkt.show() print 'IP', pkt.src, pkt.sport, '--->', pkt.dst,

Re: subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-12 Thread Veek. M
Steven D'Aprano wrote: > On Tuesday 12 July 2016 13:20, Veek. M wrote: > >> Script grabs some image data and runs imagemagick on it to extract >> some chinese. Then tesseract OCR to get the actual unicode. >> >> I then need to get it translated which also work

How do you guys tackle a package with poorish documentation?

2016-07-12 Thread Veek. M
I've been messing with QQ (a Chinese chat app) and started receiving a lot of shady traffic partly because I was stupid enough to install the insecure QQ=international version. Anyway, so I decided to write something to provide me with a diff for networks. Basically track my current n/w with

subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-11 Thread Veek. M
Script grabs some image data and runs imagemagick on it to extract some chinese. Then tesseract OCR to get the actual unicode. I then need to get it translated which also works and then display in XTerm using cat. I could cat << named_pipe but I was wondering if this was the only way? Could I

super and mix-in class: how exactly is the search order altered?

2016-07-01 Thread Veek. M
I had posted this on StackOverflow - it's an excellent example of why SO sucks (don't want that happening here so please read carefully): http://stackoverflow.com/questions/38145818/super-and-mix-in-class-how-exactly-is-the-search-order-altered?noredirect=1#comment63722336_38145818 I'm reading

Re: Descriptor: class name precedence over instance name

2016-07-02 Thread Veek. M
Ben Finney wrote: > "Veek. M" <vek.m1...@gmail.com> writes: > >> Trying to make sense of this para: > > At the risk of being ruse, I am trying to make sense of some > paragraphs in the messages you write here. Could you take a little > more time to

Re: Descriptor: class name precedence over instance name

2016-07-03 Thread Veek. M
Ian Kelly wrote: > On Sat, Jul 2, 2016 at 3:34 AM, Veek. M <vek.m1...@gmail.com> wrote: >> So essentially from what Ian said: >> data_descriptor_in_instance -> instance_attribute -> non- >> data_descriptor_in_instance -->__mro__ >> >> is how th

Re: super and mix-in class: how exactly is the search order altered?

2016-07-03 Thread Veek. M
dieter wrote: > "Veek. M" <vek.m1...@gmail.com> writes: >> ... >> I'm reading this article: >> https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ >> >> He's trying to explain the purpose of a 'mix-in class' and he says >>

Re: why x is changed in the following program?

2016-07-01 Thread Veek. M
maurice.char...@telecom-paristech.fr wrote: > from numpy import random > x=random.randn(6) > y=x > y[0]=12 > print x[0] > > > random.rand returns a list. x is a label to this list (container). y=x creates another label to the same container/list. y[0[ = 12 alters the 0th position of the

Re: subprocess startup error

2016-07-01 Thread Veek. M
Shweta Dinnimani wrote: > hi > > hello, I'm begineer to python programming.. I had installed python > 3.5.1 version on my windows 7 system. I was fine earlier and now when > i was trying the programs on string i'm facing the subprocess startup > error. IDLE is not connecting. And python shell is

Re: problem using pickle

2016-07-01 Thread Veek. M
Nicky Mac wrote: > Dear Python team, > I have studied the excellent documentation, and attempted to make use > of pickle thus: > > filename = 'my_saved_adventure' > import pickle > class object: > def __init__(self,i,.t) : > self.id = i > . > > class

Descriptor: class name precedence over instance name

2016-07-01 Thread Veek. M
Trying to make sense of this para: -- Also, the attribute name used by the class to hold a descriptor takes prece- dence over attributes stored on instances. In the previous example, this is why the descriptor object takes a name parameter and why

Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Veek. M
https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm Wanted to know if the above link idea, had been implemented and if there's a module that accepts a pattern like 'cap' and give you all the instances of unicode 'CAP' characters. ⋂ \bigcap ⊓ \sqcap ∩ \cap ♑ \capricornus

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-05 Thread Veek. M
ier. > > In fact, I have recommended doing that several times to people who > only used their nickname in the “From” header field value. > >> So Veek should be able to appease P.E. by calling >> himself 'Veek "David Smith" M'. > > That would not help. “Veek” mig

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Veek. M
Steve D'Aprano wrote: > On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote: > >>> Regarding the name (From field), my name *is* Veek.M […] >> >> Liar. *plonk* > > You have crossed a line now Thomas. > > That is absolutely uncalled for. You have absolutely no legitimate > reason to

Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-03 Thread Veek. M
Thomas 'PointedEars' Lahn wrote: > Veek. M wrote: > >> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm >> >> Wanted to know if the above link idea, > > … which is 404-compliant; the Internet Archive does not have it either > … > &

PyQT - Signals and Slots?

2016-10-10 Thread Veek M
I'm reading Rapid GUI Programming - Mark Summerfield with Python and QT pg 131. Basically the mechanism is an event table which maps a 'signal' to a 'function/slot' -correct? self.connect(dial, SIGNAL("valueChanged(int)"), spinbox.setValue) Here, dial.valueChanged -> spinbox.setValue

Re: h(re) for help, import re - on NameError

2016-09-23 Thread Veek M
Chris Angelico wrote: > On Thu, Sep 22, 2016 at 8:10 PM, Veek M <vek.m1...@gmail.com> wrote: >> Is there a way to use .pythonrc.py to provide a help function that >> autoloads whatever module name is passed like so: >> \>>> h(re) >> >> I tried

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread Veek M
eryk sun wrote: > On Thu, Sep 22, 2016 at 12:40 PM, Gregory Ewing > wrote: >> eryk sun wrote: >>> >>> Actually in a Unix terminal the cursor can also be at >>> the end of a line, but a bug in Python requires pressing Ctrl+D >>> twice in that case. >> >> I wouldn't

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread Veek M
Ben Finney wrote: > Veek M <vek.m1...@gmail.com> writes: > >> 1. I had to turn on highlighting to catch mixed indent (which >> is a good thing anyways so this was resolved - not sure how tabs got >> in anyhow) > > The EditorConfig system is a growing con

Pasting code into the cmdline interpreter

2016-09-21 Thread Veek M
I wanted to test this piece of code which is Kate (editor) on the cmd line python >>> prompt: tex_matches = re.findall(r'(\\\w+{.+?})|(\\\w+)', msg) for tex_word in tex_matches: repl = unicode_tex.tex_to_unicode_map.get(tex_word) if repl is None: repl = 'err' msg =

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread Veek M
eryk sun wrote: > On Thu, Sep 22, 2016 at 5:12 AM, Veek M <vek.m1...@gmail.com> wrote: >> 2. Blank lines in my code within the editor are perfectly acceptable >> for readability but they act as a block termination on cmd line. > > You can write a simple pa

h(re) for help, import re - on NameError

2016-09-22 Thread Veek M
Is there a way to use .pythonrc.py to provide a help function that autoloads whatever module name is passed like so: \>>> h(re) I tried inheriting site._Helper and overriding __init__ and __call__ but that didn't work, also I don't know how to deal/trap/catch the NameError (no quotes on h(re))

Re: Pasting code into the cmdline interpreter

2016-09-22 Thread Veek M
Ben Finney wrote: > Veek M <vek.m1...@gmail.com> writes: > >> Ben Finney wrote: >> >> > Since you are writing code into a module file, why not just run the >> > module from that file with the non-interactive Python interpreter? >> > >>

Re: Iteration, while loop, and for loop

2016-10-27 Thread Veek M
Elizabeth Weiss wrote: > words=["hello", "world", "spam", "eggs"] > counter=0 > max_index=len(words)-1 > > while counter<=max_index: > word=words[counter] > print(word + "!") > counter=counter + 1 while 0 < 10: get 0'th element do something with element increment 0 to 1 (repeat)

Re: Windows switch between python 2 and 3

2016-10-27 Thread Veek M
Daiyue Weng wrote: > Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. > Under > > C:\Python35 > > C:\Python27 > > Both have been set in environment variable Path. > > When I type python in cmd, it only gives me python 2.7, I am wondering > how to switch between 2 and 3 in

Re: problem using pickle

2016-10-27 Thread Veek M
Rustom Mody wrote: > On Saturday, July 2, 2016 at 9:17:01 AM UTC+5:30, Veek. M wrote: >> object is a keyword and you're using it as an identifier > > keyword and builtin are different > In this case though the advice remains the same > In general maybe not... > Ju

Re: problem using pickle

2016-10-27 Thread Veek M
Ben Finney wrote: > "Veek. M" <vek.m1...@gmail.com> writes: > >> class Foo(object): >> pass >> >> object is a keyword and you're using it as an identifier > > Python does not have ‘object’ as a keyword. ‘and’ is a keywo

Re: PyQT - Signals and Slots?

2016-10-10 Thread Veek M
Mark Summerfield wrote: > > The ZeroSpinBox is a tiny example designed to show how the signal/slot > mechanism works. It is just a QSpinBox with the addition of > remembering how many times (all the) ZeroSpinBox(es) have had a 0 > value. > > Nowadays the connections would be made with a new

Re: Web Scraping

2016-11-12 Thread Veek M
Steve D'Aprano wrote: > On Sat, 12 Nov 2016 11:07 pm, Veek M wrote: > >> 121sukha wrote: >> >>> I am new to python and I want to use web scraping to download songs >>> from website. how do I write code to check if the website has >>> uploade

Re: dictionary mutability, hashability, __eq__, __hash__

2016-11-27 Thread Veek M
Jussi Piitulainen wrote: > Veek M writes: > > [snip] > >> Also if one can do x.a = 10 or 20 or whatever, and the class instance >> is mutable, then why do books keep stating that keys need to be >> immutable? After all, __hash__ is the guy doing all the work

Re: dictionary mutability, hashability, __eq__, __hash__

2016-11-27 Thread Veek M
Veek M wrote: > Jussi Piitulainen wrote: > >> Veek M writes: >> >> [snip] >> >>> Also if one can do x.a = 10 or 20 or whatever, and the class >>> instance is mutable, then why do books keep stating that keys need >>> to be >>

dictionary mutability, hashability, __eq__, __hash__

2016-11-27 Thread Veek M
I was reading this: http://stackoverflow.com/questions/4418741/im-able-to-use-a-mutable-object-as-a-dictionary-key-in-python-is-this-not-disa In a User Defined Type, one can provide __hash__ that returns a integer as a key to a dictionary. so: d = { key : value } What is the significance of

What exactly is a python variable?

2016-11-16 Thread Veek M
In C: int x = 10; results in storage being allocated and type and location are fixed for the life of the program. In Python, x = 10 causes an object '10' to be created but how exactly is 'x' handled? Symbol Table lookup at compile time? Is every 'x' being substituted out of existence?

__debug__ http://stackoverflow.com/questions/15305688/conditional-debug-statement-not-executed-though-debug-is-true

2016-11-15 Thread Veek M
Trying to make sense of that article. My understanding of debug was simple: 1. __debug__ is always True, unless -O or -OO 2. 'if' is optimized out when True and the expr is inlined. So what does he mean by: 1. 'If you rebind __debug__, it can cause symptoms' 2. 'During module compilation, the

Re: __debug__ http://stackoverflow.com/questions/15305688/conditional-debug-statement-not-executed-though-debug-is-true

2016-11-15 Thread Veek M
Veek M wrote: > Trying to make sense of that article. My understanding of debug was > simple: > 1. __debug__ is always True, unless -O or -OO > 2. 'if' is optimized out when True and the expr is inlined. > > So what does he mean by: > > 1. 'If you rebind __debug__, it

What is the difference between class Foo(): and class Date(object):

2016-11-21 Thread Veek M
>>> class Foo(): ... pass ... >>> class Bar(Foo): ... pass ... >>> b = Bar() >>> type(b) >>> class Date(object): ... pass ... >>> class EuroDate(Date): ... pass ... >>> x = EuroDate() >>> type(x) What is going on here? Shouldn't x = EuroDate(); type(x) give 'instance'?? Why is 'b'

Re: What is the difference between class Foo(): and class Date(object):

2016-11-21 Thread Veek M
Steve D'Aprano wrote: > On Mon, 21 Nov 2016 11:15 pm, Veek M wrote: > >>>>> class Foo(): >> ... pass >> ... >>>>> class Bar(Foo): >> ... pass >> ... >>>>> b = Bar() >>>>> type(b) >> > [

  1   2   >