Question about object lifetime and access

2014-01-15 Thread Asaf Las
Hi community i am beginner in Python and have possibly silly questions i could not figure out answers for. Below is the test application working with uwsgi to test json-rpc. from multiprocessing import Process from werkze

Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
never have reference count down to 0 even if they are not referenced from functions or class methods. Is this true? Does it mean that global objects are destroyed when interpreter exits or thread where it runs is terminated? On Wednesday, January 15, 2014 2:13:56 PM UTC+2, Asaf Las wrote: >

Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
Thanks! On Wednesday, January 15, 2014 3:05:43 PM UTC+2, Chris Angelico wrote: > > > > Questions are: > > > - what is the lifetime for global object (p in this example). > > > - will the p always have value it got during module loading > > > - if new thread will be created will p be accessible

Re: Question about object lifetime and access

2014-01-15 Thread Asaf Las
First of all many thanks to all for their detailed answers on subject. I really appreciate it! > Correct. The global name is a reference, so the reference count will be > > at least 1. In fact, referencing the name from a function or method > doesn't increase the ref count: > -- > > Steven

Re: Python solve problem with string operation

2014-01-16 Thread Asaf Las
inpu = "3443331123377" tstr = inpu[0] for k in range(1, len(inpu)): if inpu[k] != inpu[k-1] : tstr = tstr + inpu[k] print(tstr) -- https://mail.python.org/mailman/listinfo/python-list

Re: python2.6 needed as an aptitude package as dependency

2014-01-17 Thread Asaf Las
On Friday, January 17, 2014 4:24:16 PM UTC+2, Jan Hapala wrote: > Hello, > I need to install a program (MACS: http://liulab.dfci.harvard.edu/MACS/) for > which I need to have Python2.6 installed. > I do have two other Pythons installed but not this version. > I will be grateful for your suggestion

Re: Python Scalability TCP Server + Background Game

2014-01-18 Thread Asaf Las
On Wednesday, January 15, 2014 8:37:25 PM UTC+2, phi...@gmail.com wrote: > My problem is as follows: > > 2) The network layer of the game server runs a separate process as well, > and my intention was to use gevent or tornado (http://nichol.as/asynchronous- >servers-in-python). > 3) The game

python-daemon for Python v3

2014-01-19 Thread Asaf Las
Hi Community Is there ported to Python v3 python-daemon package? https://pypi.python.org/pypi/python-daemon/ i am afraid it is not as simple as correction of relative path input feature and except clauses in mentioned package. Thanks Asaf -- https://mail.python.org/mailman/listinfo/python-

Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Sunday, January 19, 2014 12:41:31 PM UTC+2, Ben Finney wrote: > Have a read through the archives for the ‘python-daemon-devel’ > discussion forum > http://lists.alioth.debian.org/mailman/listinfo/python-daemon-devel>, > where we have had discussions about porting the library to Python 3. > I'd b

Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Sunday, January 19, 2014 9:30:21 PM UTC+2, larry@gmail.com wrote: > On Sun, Jan 19, 2014 at 3:30 AM, Asaf Las wrote: > I use this technique for demonizing: > http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ > And has been ported to 3: > http://www.

Re: python-daemon for Python v3

2014-01-19 Thread Asaf Las
On Monday, January 20, 2014 8:19:04 AM UTC+2, larry@gmail.com wrote: > Nope, no problems at all. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: autoconf tools and python3 3m 3dm

2014-01-21 Thread Asaf Las
On Tuesday, January 21, 2014 7:55:13 PM UTC+2, Mark Heieis wrote: > Hi, > would work either as one would need to know in advance specifically > which one to call and there'd be extra work to extract the full version > info, etc. ("$python3-config --includes" yields > -I/usr/include/python3.3m -I

Re: Separate Address number and name

2014-01-21 Thread Asaf Las
On Wednesday, January 22, 2014 1:49:16 AM UTC+2, Shane Konings wrote: > I have the following sample from a data set and I am > looking to split the address number and name into separate headings >as seen below. > I have struggled with this for a while and know there must be a simple method > to

Re: Modifying the default argument of function

2014-01-21 Thread Asaf Las
On Tuesday, January 21, 2014 9:46:16 PM UTC+2, Chris Angelico wrote: > On Wed, Jan 22, 2014 at 6:36 AM, Mû wrote: > > These were clear and quick answers to my problem. I did not think of this > > possibility: the default argument is created once, but accessible only by > > the function, therefore

Self healthcheck

2014-01-21 Thread Asaf Las
Hi When designing long running background process is it feasible to monitor object/memory leakage due to improper programming? If it could be possible to make module which monitor and record trends if alive objects then event can be generated and logged if noof "zombie" objects are to increa

Re: Self healthcheck

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 5:08:25 AM UTC+2, Chris Angelico wrote: > I assume you're talking about pure Python code, running under CPython. > (If you're writing an extension module, say in C, there are completely > different ways to detect reference leaks; and other Pythons will > behave slight

Re: Self healthcheck

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 10:43:39 AM UTC+2, Nicholas wrote: > There are some good tools recommended here:  > http://stackoverflow.com/questions/110259/which-python-memory-profiler-is-recommended >  But in general: use weak references wherever possible would be > my advice. They not only prev

SIngleton from __defaults__

2014-01-22 Thread Asaf Las
Hi Inspired by "Modifying the default argument of function" https://groups.google.com/forum/#!topic/comp.lang.python/1xtFE6uScaI is it possible to create singleton using construct below : def singleton_provider(x = [None]): if singleton_provider.__defaults__[0][0] == None: singleto

Re: Self healthcheck

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 10:56:30 AM UTC+2, Frank Millman wrote: > > class MainObject: > def __init__(self, identifier): > self._del = delwatcher('MainObject', identifier) > class delwatcher: > def __init__(self, obj_type, identifier): > self.obj_type = obj_type >

Re: SIngleton from __defaults__

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote: > On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las wrote: > > Why not simply: > def get_singleton(x = SomeClass()): > return x > Or even: > singleton = SomeClass() > ? Neither of the above provides any

Re: SIngleton from __defaults__

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 9:18:19 PM UTC+2, Ned Batchelder wrote: > Chris is right here, too: modules are themselves singletons, no matter > how many times you import them, they are only executed once, and the > same module object is provided for each import. > > Ned Batchelder, http://nedb

Re: SIngleton from __defaults__

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote: > On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las wrote: > > is it possible to create singleton using construct below : > > > > def singleton_provider(x = [None]): > > if singleton_provider

Re: Python declarative

2014-01-22 Thread Asaf Las
On Wednesday, January 15, 2014 7:02:08 PM UTC+2, Sergio Tortosa Benedito wrote: > Hi I'm developing a sort of language extension for writing GUI programs > called guilang, right now it's written in Lua but I'm considreing Python > instead (because it's more tailored to alone applications). My quest

Re: SIngleton from __defaults__

2014-01-22 Thread Asaf Las
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote: > On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las wrote: > ChrisA and this one is about multiclass container function with multithreading support: import threading def provider(cls, x = [threading.Lock(), {}]): pr

Re: sqlite3 docbug (was problem with sqlite3)

2014-01-22 Thread Asaf Las
On Thursday, January 23, 2014 6:41:42 AM UTC+2, Chris Angelico wrote: > On Thu, Jan 23, 2014 at 3:33 PM, Rustom Mody wrote: > I think it's fairly clear from the example that it has to be either a > tuple or a dict. Looks fine to me. But I'm sure that, if you come up > with better wording, a tracke

Re: Can post a code but afraid of plagiarism

2014-01-23 Thread Asaf Las
On Thursday, January 23, 2014 9:57:02 AM UTC+2, indar kumar wrote: > On Saturday, January 18, 2014 3:21:42 PM UTC-7, indar kumar wrote: > I just need to print first element of tuple not the whole in hierarchies do steps level by level, that will make things much easier: hosts={'PC2':['02:02:02:02

Re: SQLite + FTS (full text search)

2014-01-23 Thread Asaf Las
On Thursday, January 23, 2014 2:20:31 PM UTC+2, Mark Summerfield wrote: > Hi, > On my Debian stable 64-bit system, SQLite3 has FTS (full text search) > enabled (although at version 3 rather than the recommended version 4): > > Python 3.2.3 (default, Feb 20 2013, 14:44:27) [GCC 4.7.2] on linux2 >

Re: SQLite + FTS (full text search)

2014-01-23 Thread Asaf Las
On Thursday, January 23, 2014 3:39:08 PM UTC+2, Mark Lawrence wrote: > On 23/01/2014 13:24, Asaf Las wrote: > As an option can be represented in a single bit then presumably the > Windows msi file only needs an extra bit to allow for this, or have I > missed something? While I

Re: Python declarative

2014-01-24 Thread Asaf Las
On Wednesday, January 15, 2014 7:02:08 PM UTC+2, Sergio Tortosa Benedito wrote: > Hi I'm developing a sort of language extension for writing GUI programs > called guilang, right now it's written in Lua but I'm considreing Python > instead (because it's more tailored to alone applications). My quest

Class and instance related questions.

2014-01-24 Thread Asaf Las
Hi Is there way to get list of instances of particular class through class itself? via metaclass or any other method? Another question - if class is object is it possible to delete it? If it is possible then how instances of that class will behave? Thanks Asaf -- https://mail.python.org/

Re: Class and instance related questions.

2014-01-24 Thread Asaf Las
Hi Chris Thanks for answers On Friday, January 24, 2014 6:37:29 PM UTC+2, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 3:31 AM, Asaf Las wrote: > > Hi > > Is there way to get list of instances of particular > > class through class itself? via metaclass or an

Re: Class and instance related questions.

2014-01-24 Thread Asaf Las
On Friday, January 24, 2014 10:45:30 PM UTC+2, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 7:32 AM, Asaf Las wrote: > > On Friday, January 24, 2014 6:37:29 PM UTC+2, Chris Angelico wrote: > >> On Sat, Jan 25, 2014 at 3:31 AM, Asaf Las wrote: > >> > Hi >

Re: Class and instance related questions.

2014-01-24 Thread Asaf Las
On Friday, January 24, 2014 11:18:08 PM UTC+2, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 8:03 AM, Asaf Las wrote: > > Chris, i like answers which open doors to my curiosity :-) > > yet i should spend my credits very carefully :-) > Trust me, there is no limit to what you

Re: Python (windows)packet sniffer ARP

2014-02-02 Thread Asaf Las
On Friday, January 31, 2014 9:10:28 AM UTC+2, Ralle wrote: > Hello > > I am wondering if it possible to create a packet sniffer in windows using > python that only sniffs for ARP packets. In addition to Mark Betz suggestion - http://www.wireshark.org/ it works above winpcap and it is full funct

Re: Python (windows)packet sniffer ARP

2014-02-02 Thread Asaf Las
On Sunday, February 2, 2014 8:26:05 PM UTC+2, Asaf Las wrote: > On Friday, January 31, 2014 9:10:28 AM UTC+2, Ralle wrote: > > > Hello > > I am wondering if it possible to create a packet sniffer in > > windows using python that only sniffs for ARP packets. There is a

Re: bw2ui installation failure

2014-02-02 Thread Asaf Las
On Sunday, February 2, 2014 9:20:32 PM UTC+2, e-letter wrote: > Readers, > Firstly, sorry for the cross-post: > https://groups.google.com/d/topic/brightway2/-akB-OQBZi4 > Any advice about forcing installation of a later version of a software please? for pip it is: pip install --upgrade module_name

Re: [newbie] making rows of table with discrete values for different number systems

2014-02-02 Thread Asaf Las
On Sunday, February 2, 2014 10:51:15 PM UTC+2, Jean Dupont wrote: > Op zondag 2 februari 2014 19:10:32 UTC+1 schreef Peter Otten: > > I'm looking for an efficient method to produce rows of tables like this: > jean you can also try to make below universal for all needed bases: m = lambda m, n:

Re: Python declarative

2014-02-02 Thread Asaf Las
On Sunday, January 26, 2014 4:45:59 AM UTC+2, Mark Lawrence wrote: > On 26/01/2014 02:33, Steven D'Aprano wrote: > > If I worked as a consultant I'd much prefer the XML version as I'd be > able to charge much more on the grounds that I'd done much more, hoping > that the people paying didn't bot

Re: [newbie] making rows of table with discrete values for different number systems

2014-02-03 Thread Asaf Las
On Monday, February 3, 2014 5:05:40 PM UTC+2, Jean Dupont wrote: > Op maandag 3 februari 2014 02:56:43 UTC+1 schreef Asaf Las: > > > On Sunday, February 2, 2014 10:51:15 PM UTC+2, Jean Dupont wrote: > > > Op zondag 2 februari 2014 19:10:32 UTC+1 schreef Peter Otten: >

Re: [newbie] troubles with tuples

2014-02-03 Thread Asaf Las
On Monday, February 3, 2014 6:50:31 PM UTC+2, Jean Dupont wrote: > I'm looking at the way to address tuples > > e.g. > tup2 = (1, 2, 3, 4, 5, 6, 7 ); > As I found out indices start with 0 in Python, so > tup2[0] gives me 1, the first element in the tuple as expected > tup2[1] gives me 2, the seco

Re: [newbie] making rows of table with discrete values for different number systems

2014-02-03 Thread Asaf Las
On Monday, February 3, 2014 9:37:36 PM UTC+2, Jean Dupont wrote: > Op maandag 3 februari 2014 16:34:18 UTC+1 schreef Asaf Las: > > Of course you don't have to, but I'm curious and learn well by examples > > :-( And making this design generic is really a good e

Re: [newbie] making rows of table with discrete values for different number systems

2014-02-03 Thread Asaf Las
On Monday, February 3, 2014 9:37:36 PM UTC+2, Jean Dupont wrote: > Op maandag 3 februari 2014 16:34:18 UTC+1 schreef Asaf Las: > > Of course you don't have to, but I'm curious and learn well by examples > :-( Hi Jean Don't get me wrong i did not mean to be rude (wa

Re: Finding size of Variable

2014-02-04 Thread Asaf Las
On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote: > > As I said, I need to merge large files and I cannot afford more I/O > operations. So in order to minimise the I/O operation I am writing in > chunks. Also, I need to use the merged files as indexes later which > should be l

Python installation/cleanup management

2014-02-05 Thread Asaf Las
Hi What is the best way to manage Python isolated from /bin /usr/bin ... installations done via source code compilation on yum/rpm based systems? there are some alternatives i guess could be done: * configure --prefix, then delete * checkinstall * fpm (questionable for python?) * make altins

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 2:10:16 AM UTC+2, Zhen Zhang wrote: > Hi, every one. > Zhen str_t = '3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1' list_t = str_t.split(',') print(list_t) print("split result ", list_t[1], list_t[5]) print(list_t[1].split('"

Re: Python installation/cleanup management

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 1:31:58 AM UTC+2, Asaf Las wrote: > > Asaf Epel repository provides paco for CentOS. Guess RH does same. paco x86_64 2.0.9-6.el6 (yet there are couple of other tools based on interception of copied files during make i

Re: Python installation/cleanup management

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 3:19:00 AM UTC+2, Asaf Las wrote: > On Thursday, February 6, 2014 1:31:58 AM UTC+2, Asaf Las wrote: so far smallest footprint one: http://my.opera.com/ruario/blog/2012/02/15/tracking-software-that-you-have-compiled-locally -- https://mail.python.org/mail

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote: > On 2014-02-05 16:10, Zhen Zhang wrote: > Asaf recommended using string methods to split the file. Keep doing > what you're doing (using the csv module), as it attends to a lot of > edge-cases that will trip you up otherwise. I lea

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 6:09:52 AM UTC+2, Tim Chase wrote: > On 2014-02-05 19:59, Asaf Las wrote: > From your code, > list_t = str_t.split(',') > It might have been a short-hand for obtaining the results of a CSV > row, but it might be better written something lik

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 5:02:09 AM UTC+2, msu...@gmail.com wrote: > I had a bug in a Python script recently. The code in question was > something along the lines of: > if a == 1: > x = y > else: > x = z > y = z + y > z = z + 1 > > While editing this file I accidentally pushed TAB on

Re: parse a csv file into a text file

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 9:52:43 AM UTC+2, Zhen Zhang wrote: > On Wednesday, February 5, 2014 7:33:00 PM UTC-5, Roy Smith wrote: > I failed to figure out why. OK, you had to look to what i posted second time. The first one is irrelevant. Note that file was emulated using StringIO. in your c

Re: parse a csv file into a text file

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 10:15:14 AM UTC+2, Asaf Las wrote: > On Thursday, February 6, 2014 9:52:43 AM UTC+2, Zhen Zhang wrote: > case it will be file name. little correction not a file name - file object, file_t is result from open() as you did in your example -- https://mail.pyth

Re: TypeError: 'list' object is not callable

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 11:11:13 AM UTC+2, wilso...@gmail.com wrote: > i follow in > http://www.dyinglovegrape.com/data_analysis/part1/1da3.php > still have error > what is the correct writing? give another name to list 'open' at line 'open= []' change it to dopen or whatever. you make name

Re: ANN: A new version (0.3.6) of python-gnupg has been released.

2014-02-06 Thread Asaf Las
On Thursday, February 6, 2014 10:53:59 PM UTC+2, Vinay Sajip wrote: > A new version of the Python module which wraps GnuPG has been > released. > Cheers > > Vinay Sajip > > Red Dove Consultants Ltd. Hi Good job! One question - is this package runs executable when particular function must be

Re: how to reduce bugs due to incorrect indentation

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 12:30:17 AM UTC+2, Chris Angelico wrote: > On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell wrote: > > > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > > bitten by this many time when I had to work on a program written by > > another. They had the

Re: Question about `list.insert`

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 5:00:56 AM UTC+2, Roy Smith wrote: > In article , > > Dave Angel wrote: > > list does not promise better than O(1) behavior > I'm not aware of any list implementations, in any language, that > promises better than O(1) behavior for any operations. Perhaps there is >

Re: Question about `list.insert`

2014-02-06 Thread Asaf Las
On Friday, February 7, 2014 6:52:24 AM UTC+2, Dan Stromberg wrote: > On Thu, Feb 6, 2014 at 3:59 PM, cool-RR wrote: > > I'm pretty sure it'll slide all the existing elements right one > position, and add at the leftmost position just opened up - assuming > you're inserting at position 0. > > As

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-07 Thread Asaf Las
On Friday, February 7, 2014 8:06:36 PM UTC+2, Johannes Bauer wrote: > Hi group, > > I'm using Python 3.3.2+ (default, Oct 9 2013, 14:50:09) [GCC 4.8.1] on > linux and have found what is very peculiar behavior at best and a bug at > worst. It regards the mimetypes module and in particular the > gu

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-07 Thread Asaf Las
btw, had seen this after own post - example usage includes mimetypes.init() before call to module functions. -- https://mail.python.org/mailman/listinfo/python-list

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-07 Thread Asaf Las
On Friday, February 7, 2014 9:40:06 PM UTC+2, Peter Otten wrote: > As Johannes mentioned, this depends on the hash seed: > $ PYTHONHASHSEED=0 python3 -c 'print({".htm", ".html", ".shtml"}.pop())' > .html > $ PYTHONHASHSEED=1 python3 -c 'print({".htm", ".html", ".shtml"}.pop())' > .htm > $ PYTHONHAS

Re: Python 2.7.6 help with white spaces?

2014-02-07 Thread Asaf Las
On Friday, February 7, 2014 11:11:37 PM UTC+2, Mark Lawrence wrote: > > Fancy wasting two whole characters when this will suffice > > print("{}:{}".format(minutes,seconds)) :) > > > Mark Lawrence H, got error: File "", line 1 print("{}:{}".format(minutes,seconds)) :)

Re: Using virtualenv to bypass sudoer issues

2014-02-07 Thread Asaf Las
On Saturday, February 8, 2014 3:18:02 AM UTC+2, Cameron Simpson wrote: > On 06Feb2014 18:32, Jean-Michel Pichavant wrote: > > > Assuming I have a debian workstation for which I don't have any > > sudo rights, in order to be able to install / remove python packages, > > should I be using virtualen

Re: Using virtualenv to bypass sudoer issues

2014-02-07 Thread Asaf Las
On Saturday, February 8, 2014 5:32:22 AM UTC+2, Cameron Simpson wrote: > On 07Feb2014 19:03, Asaf Las wrote: > > Persuming you are asking about "just make a lib directory and point > $PYTHONPATH at it" instead of virtualenv, in principle yes. > But it is more work; vi

Re: Python 2.7.6 help with modules

2014-02-07 Thread Asaf Las
On Saturday, February 8, 2014 7:05:49 AM UTC+2, Rustom Mody wrote: > On Saturday, February 8, 2014 10:14:10 AM UTC+5:30, Scott W Dunning wrote: > > > I have a question that was a part of my homework > > and I got it correct but the teacher urged me to do it using the > > % sign rather than subtr

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 9:41:53 AM UTC+2, cstru...@gmail.com wrote: > I am writing a couple of class methods to build up several > lines of html. Some of the lines are conditional and most need > variables inserted in them. Searching the web has given me a > few ideas. Each has its pro'

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote: > > At least the mimetypes already defined in the module could easily produce > the same guessed extension consistently. imho one workaround for OP could be to supply own map file in init() thus ensure unambiguous mapping across

Re: Possible bug with stability of mimetypes.guess_* function output

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 10:39:06 AM UTC+2, Peter Otten wrote: > Asaf Las wrote: > > On Saturday, February 8, 2014 9:51:48 AM UTC+2, Peter Otten wrote: > >> At least the mimetypes already defined in the module could easily produce > >> the same guessed extension

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 10:52:36 AM UTC+2, Sam wrote: > I am writing my first python script to access MySQL database. > With reference to > http://mysql-python.sourceforge.net/MySQLdb.html#connection-objects > Why is it advisable to use _mysql and not MySQLdb module directly? I used this o

Re: What is the most pythonic way to build up large strings?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 11:56:46 AM UTC+2, cstru...@gmail.com wrote: > On Saturday, February 8, 2014 3:13:54 AM UTC-5, Asaf Las wrote: > > > > > > > > note, due to strings are immutable - for every line in sum operation > > > > > > abo

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 1:25:15 PM UTC+2, Chris Angelico wrote: > On Sat, Feb 8, 2014 at 10:09 PM, Asaf Las wrote: > > > I used this one from Oracle and it was OK for simple test case and > > supports from 2.6 till 3.3: > > http://dev.mysql.com/doc/connector-python

Re: Why use _mysql module and not use MySQLdb directly?

2014-02-08 Thread Asaf Las
On Saturday, February 8, 2014 1:42:30 PM UTC+2, Chris Angelico wrote: > On Sat, Feb 8, 2014 at 10:32 PM, Asaf Las wrote: > > > Hi Chris > > The doc says > > https://pypi.python.org/pypi/mysql-connector-python/1.1.5 > > MySQL driver written in Python which does no

Re: What are the kinds of software that are not advisable to be developed using Python?

2014-02-08 Thread Asaf Las
On Sunday, February 9, 2014 5:43:47 AM UTC+2, Steven D'Aprano wrote: > Nevertheless, although security by obscurity is ineffective[1], Python > supports it. You can ship only the .pyc files. For added obscurity, you > could put the .pyc files in a .zip file and ship that. For even more > obscuri

system wide mutex

2014-02-09 Thread Asaf Las
Hi Which one is most recommended to use for mutex alike locking to achieve atomic access to single resource: - fcntl.lockf - os.open() with O_SHLOCK and O_EXLOCK - https://pypi.python.org/pypi/lockfile/0.9.1 - https://pypi.python.org/pypi/zc.lockfile/1.1.0 - any other ? Thanks /Asaf -- htt

Re: system wide mutex

2014-02-09 Thread Asaf Las
Forget to mentioned - CentOS 6.5 Python v3.3. -- https://mail.python.org/mailman/listinfo/python-list

Re: system wide mutex

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 1:00:39 PM UTC+2, Skip Montanaro wrote: > > Which one is most recommended to use for mutex alike locking to > > achieve atomic access to single resource: > > > > - fcntl.lockf > > - os.open() with O_SHLOCK and O_EXLOCK > > - https://pypi.python.org/pypi/lockfile/0.9.1 >

Re: Sort one sequence by O(n) in time and O(1) in space

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 2:13:50 PM UTC+2, Wesley wrote: > Hi guys, >Here is one question related to algorithm. > Details here: > > here is input sequence like a1,a2,...,an,b1,b2,...,bn ,the ax and bx always > exist in pair. So, now, how to change the sequence to a1,b1,...,an,bn, with > t

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 1:00:58 PM UTC+2, Chris Angelico wrote: > The biggest downside of SQLite3 is concurrency. I haven't dug into the > exact details of the pager system and such, but it seems to be fairly > coarse in its locking. Also, stuff gets a bit complicated when you do > a single tra

Re: Help!

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 2:25:16 PM UTC+2, Moz wrote: > I want to make something that can aid me financially. If you have > done something like this please can you provide me with the resources > and the libraries so that i may study even further. > > Thanks You! you can try similar to this

Re: What is the recommended python module for SQL database access?

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 3:14:50 PM UTC+2, Chris Angelico wrote: > On Sun, Feb 9, 2014 at 11:47 PM, Asaf Las wrote: > Thanks > > Also, you're connecting and disconnecting repeatedly... oh, I see why > it didn't work when I tried. You're also using two complet

Re: system wide mutex

2014-02-09 Thread Asaf Las
Hi Thanks for replies. It would be good to have blocking implementation. I have to check fcntl if it works in blocking mdoe on CentOS. Meanwhile there is Posix Semaphore made for Python: http://semanchuk.com/philip/posix_ipc/ will try it as well. /Asaf -- https://mail.python.org/mailman/li

Re: Python (?) webserver for WSGI

2014-02-09 Thread Asaf Las
On Sunday, February 9, 2014 11:05:58 PM UTC+2, Nicholas wrote: > Dear List, > > > > What is the latest "best-practice" for deploying a python wsgi > application into production? > > For development, I've been using CherryPyWSGIServer which has been > working very well (and the code is small eno

Re: Finding size of Variable

2014-02-10 Thread Asaf Las
On Monday, February 10, 2014 4:07:14 PM UTC+2, wxjm...@gmail.com wrote: Interesting > >>> sys.getsizeof('a' * 100) here you get string type > >>> sys.getsizeof(('a' * 100 + 'oe' + '\U0001').encode('utf-8')) and here bytes >>> type ('a' * 1) >>> type(('a' * 100 + 'oe' + '\U

Re: Using virtualenv to bypass sudoer issues

2014-02-10 Thread Asaf Las
On Monday, February 10, 2014 4:46:31 PM UTC+2, Jean-Michel Pichavant wrote: > > Call the venv version of python and activation is handled. > > E.g. in a fabfile > > > > myenv/bin/python myscript.py > > > > -- > > Pete Forman > > -- > > https://mail.python.org/mailman/listinfo/python-list > >

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > Hi > > can anyone help finding the angle to draw different polygons shapes > in this example > import turtle > wm = turtle.Screen() > alex = turtle.Turtle() > for i in range(5): > alex.left(216) > alex.forward(50

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 2:23:11 AM UTC+2, Asaf Las wrote: > On Tuesday, February 11, 2014 1:44:28 AM UTC+2, geni...@gmail.com wrote: > > Hi > > > > can anyone help finding the angle to draw different polygons shapes > > in this example > > import turtle

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 4:13:16 AM UTC+2, geni...@gmail.com wrote: > Well how about the star of david what are the angles hexagon is not constructed similar to your program for pentagon because crossing path can't jump from one triangle to another. you have 60 degrees turn after 2 turns edg

Re: Sorting dictionary by datetime value

2014-02-10 Thread Asaf Las
Why not use collections.OrderedDict ? There are nice examples in doc: http://docs.python.org/3.3/library/collections.html?highlight=ordered#ordereddict-examples-and-recipes -- https://mail.python.org/mailman/listinfo/python-list

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 4:51:56 AM UTC+2, geni...@gmail.com wrote: > so does that mean i have to draw two separate triangles If you need view of crossing triangles - yes, this is the simplest recipe. -- https://mail.python.org/mailman/listinfo/python-list

Re: What is the recommended python module for SQL database access?

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 4:57:30 AM UTC+2, Walter Hurry wrote: > Chris Angelico wrote: > > > > And definitely don't go for a non-free option (MS-SQL, DB2, etc) > > unless you've looked into it really closely and you are absolutely > > thoroughly *sure* that you need that system (which probably

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 5:01:33 AM UTC+2, geni...@gmail.com wrote: > Is there a better way of drawing such as another modules Could you please elaborate with question? What do you mean? -- https://mail.python.org/mailman/listinfo/python-list

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 5:06:11 AM UTC+2, geni...@gmail.com wrote: > A better way to draw stuff on screen It depends on particular case/figure you wish to draw. Drawing is separate knowledge field with its own set of algorithms. Geometry is field of wonders. i never dealt with this stuff

Re: Drawing polygons in python turtle

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 5:19:52 AM UTC+2, geni...@gmail.com wrote: > Going off-topic Which resource do you recommend for learning this > wonderful language My advice won't be good as mentioned before i never dealt with it. You have chance to discover that country yourself or wait for advic

Re: What is the recommended python module for SQL database access?

2014-02-10 Thread Asaf Las
On Tuesday, February 11, 2014 5:31:35 AM UTC+2, Chris Angelico wrote: > On Tue, Feb 11, 2014 at 2:02 PM, Asaf Las wrote: > > > On Tuesday, February 11, 2014 4:57:30 AM UTC+2, Walter Hurry wrote: > >> Chris Angelico wrote: > >> > > >> > And definitel

Re: Get a datetime with nanoseconds

2014-02-11 Thread Asaf Las
On Tuesday, February 11, 2014 7:42:16 AM UTC+2, Igor Korot wrote: > Hi, ALL, > > I am woking on an application for digital forensic. > > In this application I am getting this 2 pieces of information: > >   > > atime - long representing the time stamp > > atime_nano - long representing the nano

Re: pip3.x error using LIST instead of list

2014-02-11 Thread Asaf Las
On Tuesday, February 11, 2014 4:10:32 PM UTC+2, Mark Lawrence wrote: > As the subject line says, details below. > c:\Python34\Scripts>pip3.4 LIST > Traceback (most recent call last): >File "C:\Python34\lib\runpy.py", line 189, in _run_module_as_main > "__main__", mod_spec) >File "C:\Py

Re: pip3.x error using LIST instead of list

2014-02-11 Thread Asaf Las
https://groups.google.com/forum/#!topic/python-virtualenv/8wzQfjQW2i8 -- https://mail.python.org/mailman/listinfo/python-list

singleton ... again

2014-02-11 Thread Asaf Las
playing a bit with subject. pros and cons of this approach? did i create bicycle again? :-) class myclass(object): class_instance = None def __new__(cls, *args, **kwargs): if myclass.class_instance == None: return object.__new__(cls) return myclass.class_

Re: singleton ... again

2014-02-11 Thread Asaf Las
there is error should assign weakref to class static member otherwise __del__ will never be called. -- https://mail.python.org/mailman/listinfo/python-list

Re: singleton ... again

2014-02-12 Thread Asaf Las
On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: > > Perhaps if you would state your actual goal, we could judge > whether this code is an effective way to accomplish > it. > DaveA Thanks! There is no specific goal, i am in process of building pattern knowledge in python b

Re: singleton ... again

2014-02-12 Thread Asaf Las
There is another one. Once object passes through singletonizator there wont be any other object than first one. Then object constructor can freely be used in every place of code. Curious if there could be any impact and applicability of this to builtin types. p.s. learned today that object

  1   2   >