Re: Inconsistent SMTP/Gmail connection drop

2011-08-03 Thread David Stanek
On Wed, Aug 3, 2011 at 5:46 PM, Astley Le Jasper wrote: > > Any ideas? > Is it possible that the first email is sent before the network connection has been properly established? -- David blog: http://www.traceback.org twitter: http://twitter.com/dstanek www: http://dstanek.com -- http://mail.

Re: Application and package of the same name

2017-10-21 Thread David Stanek
pattern I've seen commonly used. > This is actually a common pattern I see when teaching the language. For example, when a student wants to test out a package like requests many seem to initially want to create a requests.py module. Then they become very confused when they get an Att

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-09 Thread David Stanek
here was still a lot of new stuff. -- david stanek web: https://dstanek.com twitter: https://twitter.com/dstanek -- https://mail.python.org/mailman/listinfo/python-list

Re: why does list's .remove() does not return an object?

2018-05-17 Thread David Stanek
ng that they want to be able to do some sort of method chaining like: the_list.remove(x).remove(y) Although the clarifying example was contrived and confusing. A more concrete example would be greatly appreciated. -- david stanek web: https://dstanek.com twitter: https://twitter.com/dstanek -- https://mail.python.org/mailman/listinfo/python-list

Cleveland Ohio Python Meeting

2005-09-28 Thread David Stanek
October 6 from 18:30-20:30 A presentation will be given on Django and I am sure that we will discuss web frameworks in general. Everyone is welcome. For more details take a look at http://www.clepy.org/meetings/2005_10_06_mtg_details David -- GPG keyID #6272EDAF on http://pgp.mit.edu Key finger

Re: Cleveland Ohio Python Meeting

2005-09-30 Thread David Stanek
On Wed, Sep 28, 2005 at 07:10:15AM -0400, David Stanek wrote: > October 6 from 18:30-20:30 > > A presentation will be given on Django and I am sure that we will > discuss web frameworks in general. Everyone is welcome. For more > details take a look at > http://www.

ANN: Cleveland Area Python Interest Group

2005-06-02 Thread David Stanek
I am attempting to start a Cleveland (Ohio) Python Interest Group. This group is a revival of the very inactive Cleveland Python Meetup Group. If you are in the Cleveland area and are interested goto http://www.clepy.org for more information. -- David Stanek www.roninds.net GPG keyID #6272EDAF

Re: mod_python config problem

2005-06-03 Thread David Stanek
thonDebug On Try adding the following line to your .htaccess file: PythonPath "sys.path + ['/your/path']" Where '/your/path' is the path in which mptest.py resides. -- David Stanek www.roninds.net GPG keyID #6272EDAF on http://pgp.mit.edu Key fingerprin

Python interest group software

2005-06-03 Thread David Stanek
Is there already any software out there to manage a Python Interest Group? Something that can register users, take RSVPs for meetings, etc. -- David Stanek www.roninds.net GPG keyID #6272EDAF on http://pgp.mit.edu Key fingerprint = 8BAA 7E11 8856 E148 6833 655A 92E2 3E00 6272 EDAF

Re: Autogenerate functions (array of lambdas)

2007-09-06 Thread David Stanek
On 9/6/07, Chris Johnson <[EMAIL PROTECTED]> wrote: > > What I want to do is build an array of lambda functions, like so: > > a = [lambda: i for i in range(10)] > > (This is just a demonstrative dummy array. I don't need better ways to > achieve the above functionality.) > > print [f() for f in a]

Re: Getting original working directory

2007-09-06 Thread David Stanek
On 9/6/07, rave247 rave247 <[EMAIL PROTECTED]> wrote: > > If I could use os.getcwd() or save the value to some variable before > calling os.chdir() I would do it, believe me. However I can't because it > is the part of code where I can't do any changes. Why is it not possible. If nothing else cre

Re: SVN/CVS and Branching

2009-02-19 Thread David Stanek
On Thu, Feb 19, 2009 at 7:10 AM, Jeff Dyke wrote: > Fair enough. Say my project is called foo, and it has many > submodules. So there are imports that may look like `import foo.bar` > or `from foo.bar import baz`, if i change the top level directory, it > is no longer foo and then those imports

Re: Basic misunderstanding of generators

2008-12-22 Thread David Stanek
On Mon, Dec 22, 2008 at 4:47 AM, Barak, Ron wrote: > > if __name__ == "__main__": > filename = "sac.log.gz" > log_stream = LogStream(filename) > line_ = log_stream.next_line(log_stream.input_file) > print line_ > > $ python LogManager_try.py > > A method or function containing a

Re: Event Driven programming - Doubts

2008-12-22 Thread David Stanek
On Mon, Dec 22, 2008 at 9:57 AM, Kottiyath wrote: > > If so, Even though data locking etc is not a problem, are we not still > having threads? Will it not still cause scalability problems in high > traffic? > If not, could somebody let me know how it is done? This somewhat depends on the applicat

Re: Exec inside a class method to call other class methods?

2008-12-25 Thread David Stanek
On Thu, Dec 25, 2008 at 1:22 PM, Matthew Dubins wrote: > Hello all, > > I have made a python script to upload contact information from an excel > worksheet to an online database. One part of the program that really > tripped me up was when I wanted to call specific class methods that I had > made

Re: Exec inside a class method to call other class methods?

2008-12-25 Thread David Stanek
On Thu, Dec 25, 2008 at 6:22 PM, Matthew Dubins wrote: > Each type does contain its own parsing method. It's just that, as it > stands, one method is being used to shunt off the data to the correct > parsing method. > Not really. You have all of the parsing methods in a single class. Is it possi

Re: Exec inside a class method to call other class methods?

2008-12-25 Thread David Stanek
You won't need the dictionary at all if each type has a parse method. On 12/25/08, Chris Rebert wrote: > On Thu, Dec 25, 2008 at 4:16 PM, J. Clifford Dyer > wrote: > >> and so forth. Then your if/else chain can be pulled out to the place >> where you instantiate each field: >> >> if data_type=

Re: Code coverage to Python code

2009-01-04 Thread David Stanek
On Sun, Jan 4, 2009 at 9:26 PM, Roy Smith wrote: > In article , > Robert Kern wrote: > >> Hussein B wrote: >> > Hey, >> > What is the best code coverage tool available for Python? >> >> I like Titus Brown's figleaf. >> >> http://darcs.idyll.org/~t/projects/figleaf/doc/ > > I was playing with Ned

Re: PyPI editing

2009-03-05 Thread David Stanek
On Thu, Mar 5, 2009 at 3:32 AM, andrew cooke wrote: > > Apparently not (this will probably change, but see > http://pypi.python.org/pypi/LEPL/2.0.1 which is currently displaying > restructured text literally) > Did you put the ReST in the description or the long_description? Take a look at the se

Re: Why is lambda allowed as a key in a dict?

2009-03-09 Thread David Stanek
On Mon, Mar 9, 2009 at 11:07 PM, Daniel Fetchinson wrote: > Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26) > [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. x = { } x[lambda arg: arg] = 5 x[lambda arg: arg]

Re: Style question - defining immutable class data members

2009-03-14 Thread David Stanek
On Sat, Mar 14, 2009 at 12:32 PM, Maxim Khitrov wrote: > Very simple question on the preferred coding style. I frequently write > classes that have some data members initialized to immutable values. > For example: > > class Test(object): >    def __init__(self): >        self.some_value = 0 >    

Re: __init__ vs. __del__

2009-03-22 Thread David Stanek
2009/3/21 Randy Turner : > There are a number of use-cases for object "cleanup" that are not covered by > a generic garbage collector... > > For instance, if an object is "caching" data that needs to be flushed to > some persistent resource, then the GC has > no idea about this. > > It seems to be

Re: Thoughts on language-level configuration support?

2009-03-30 Thread David Stanek
On Mon, Mar 30, 2009 at 9:40 AM, jfager wrote: > I've written a short post on including support for configuration down > at the language level, including a small preliminary half-functional > example of what this might look like in Python, available at > http://jasonfager.com/?p=440. > > The basic

Re: Thoughts on language-level configuration support?

2009-03-31 Thread David Stanek
On Tue, Mar 31, 2009 at 3:19 AM, jfager wrote: > > "Simply having a configuration file" - okay.  What format?  What if > the end user wants to keep their configuration info in LDAP?  Did the > library I'm including make the same decisions, or do I have to do some > contortions to adapt?  Didn't I

Re: Thoughts on language-level configuration support?

2009-03-31 Thread David Stanek
On Tue, Mar 31, 2009 at 10:01 AM, jfager wrote: > On Mar 31, 6:02 am, David Stanek wrote: >> On Tue, Mar 31, 2009 at 3:19 AM, jfager wrote: >> >> > "Simply having a configuration file" - okay.  What format?  What if >> > the end user wants to keep

Re: Thoughts on language-level configuration support?

2009-03-31 Thread David Stanek
On Tue, Mar 31, 2009 at 9:42 PM, Lawrence D'Oliveiro wrote: > In message <36148830-22c0-4f19-ab23- > d04d8755a...@s28g2000vbp.googlegroups.com>, jfager wrote: > >> I've written a short post on including support for configuration down >> at the language level ... > > If you're advocating anything r

Re: Spring-like IoC in python?

2009-04-05 Thread David Stanek
On Sun, Apr 5, 2009 at 5:51 AM, Giovanni Giorgi wrote: > Hi all, I have just read the Thread "Thoughts on language-level > configuration support?" started by jfager. > I have worked in the past days with Java Spring. > I found very valuable the ideas behind Inversion of Control (IoC). > I think it

Re: Spring-like IoC in python?

2009-04-05 Thread David Stanek
On Sun, Apr 5, 2009 at 9:24 AM, andrew cooke wrote: > David Stanek wrote: > [...] >> The documentation is a little lacking, but that will be changing in >> the next few days. Examples of using snake-guice with CherryPy, Django >> and TurboGears are just a few days off

Re: Imports in python are static, any solution?

2009-04-13 Thread David Stanek
On Mon, Apr 13, 2009 at 11:59 AM, Ravi wrote: > foo.py : > >    i = 10 > >   def fi(): >      global i >      i = 99 > > bar.py : > >    import foo >    from foo import i > >    print i, foo.i >    foo.fi() >    print i, foo.i > > This is problematic. Well I want i to change with foo.fi() . Why n

Re: Passing all extra commandline arguments to python program, Optparse raises exception

2009-04-19 Thread David Stanek
On Thu, Apr 16, 2009 at 10:05 AM, sapsi wrote: > Hello, > Im using optparse and python 2.6 to parse some options, my commandline > looks like > > prog [options] start|stop extra-args-i-will-pas-on > > The options are --b --c --d > > The extra options are varied are are passed onto another program

Re: execfile (exec?) create non consistent locals() state

2009-04-22 Thread David Stanek
>> I expected exec to work the same, but apparently I was wrong. Is there is a >> way to exec a file "more" correctly? thus avoid the need to resort to >> awkward solutions such as using the locals() dictionary? > > I don't know personally. Perhaps a kind soul will chime in. > Why not just exec in

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-22 Thread David Stanek
On Wed, Apr 22, 2009 at 7:06 PM, David Lyon wrote: > > One of the big challenges for Python going forward is providing a testing > infrastructure for Python Packages. > > There are now over 6,000 packages listed on PyPi - and this number can only > get bigger. > Interesting ideas, but I'm not sur

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-22 Thread David Stanek
On Wed, Apr 22, 2009 at 10:39 PM, David Lyon wrote: > Hi David, > > > > Yes, I agree... > > But as an end-application-developer, I would put it to you that it is a lot > of effort for developers to humanly contact the package developers every > time we end-developers find a bug. > The task (for us

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 2:47 AM, Daniel Fetchinson wrote: > > The OP is just thinking out loud that it would be great if developers > could count on some help for testing various platforms and versions. > And I agree, it would indeed be great. > I think you interpreted the OP differently. As I sa

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 12:33 AM, David Lyon wrote: > Hi Steve, >>> Why should the package developer dictacte which python version the >>> package will run on ? >> >> Because they're the developer. Who else should decide what Python >> versions to support? > The developer shouldn't be making such

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 1:12 PM, norseman wrote: > > BB's, User Lists, all repositories can make these required before > acceptance. > > This is open source. I volunteer my time on the projects that I maintain. If you don't like the quality or lack of documentations, tests, etc. Contribute. Or ju

Re: Configuring pylint for local conventions (was: pyflakes, pylint, pychecker - and other tools)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 12:00 PM, Aahz wrote: > In article <874owf4gky.fsf...@benfinney.id.au>, > Ben Finney   wrote: >>a...@pythoncraft.com (Aahz) writes: >>> >>> Second, you can configure pylint to respect your personal style >> >>How? I haven't seen any decent documentation on doing so. > > Act

Re: Configuring pylint for local conventions

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 10:21 PM, Ben Finney wrote: > Ben Finney writes: > >> David Stanek writes: >> >> > I believe you just: >> >   pylint --generate-rcfile > ~/.pylintrc >> > and then customize that file. >> >> This is the part

Re: object query assigned variable name?

2009-05-02 Thread David Stanek
On Fri, May 1, 2009 at 12:48 PM, Steven D'Aprano wrote: > On Fri, 01 May 2009 09:24:10 -0700, warpcat wrote: > >> I'd like it to print, when instanced, something like this: >> > s = Spam() >> I’m assigned to s! >> >> But it seems prohibitively hard (based on my web and forum searches) for >> a

Re: Python code-bloat tool-- warning n00b stuff...

2009-05-18 Thread David Stanek
On Mon, May 18, 2009 at 12:45 PM, david wright > > I would suggest looking into TDD (test driven development). > > This technique would be a good fit to eliminate you feeling of code bloat, in > TDD you only write the necessary amount > of code to make your test pass, hence you never write code th

Re: strip char from list of strings

2009-05-19 Thread David Stanek
On Mon, May 18, 2009 at 3:30 PM, Laurent Luce wrote: > > I have the following list: > > [ 'test\n', test2\n', 'test3\n' ] > > I want to remove the '\n' from each string in place, what is the most > efficient way to do that ? > What have you tried so far? -- David blog: http://www.traceback.org

Re: Performance java vs. python

2009-05-19 Thread David Stanek
On Tue, May 19, 2009 at 5:43 PM, namekuseijin wrote: > someone said: > > If you took a look at Java, you would > notice that the core language syntax is much simpler than Python's. > > thanks for the laughs whoever you are! > I'm no Java fan, but I do agree that the core language is a

Re: try except inside exec

2009-05-29 Thread David Stanek
On Fri, May 29, 2009 at 11:55 AM, Michele Petrazzo wrote: > > My goal is to execute a function received from a third-part, so I cannot > modify as you made in your first piece of code. > I want a "clean" exception with the real line code/tb so I can show a "real" > error message. This means that t

Re: scaling problems

2008-05-19 Thread David Stanek
On Mon, May 19, 2008 at 8:47 PM, James A. Donald <[EMAIL PROTECTED]> wrote: > I am just getting into python, and know little about it, and am > posting to ask on what beaches the salt water crocodiles hang out. > > 1. Looks to me that python will not scale to very large programs, > partly because

Re: scaling problems

2008-05-20 Thread David Stanek
On Tue, May 20, 2008 at 12:03 AM, James A. Donald <[EMAIL PROTECTED]> wrote: > On Mon, 19 May 2008 21:04:28 -0400, "David Stanek" > <[EMAIL PROTECTED]> wrote: >> What is the difference if you have a process with 10 threads or 10 >> separate processes runni

Re: pylint naming conventions?

2009-06-07 Thread David Stanek
On Sun, Jun 7, 2009 at 9:23 AM, Esmail wrote: > Ben Finney wrote: >> >> Esmail writes: >> >>> I am confused by pylint's naming conventions, I don't think the are in >>> tune with Python's style recommendations (PEP 8?) >>> >>> Anyone else think this? >> >> It's hard to know, without examples. Can

Re: Odd closure issue for generators

2009-06-08 Thread David Stanek
On Thu, Jun 4, 2009 at 7:42 PM, Scott David Daniels wrote: > Brian Quinlan wrote: >> >> This is from Python built from the py3k branch: >>  >>> c = (lambda : i for i in range(11, 16)) >>  >>> for q in c: >> ...     print(q()) >> ... >> 11 >> 12 >> 13 >> 14 >> 15 >>  >>> # This is expected >>  >>> c

Re: Guidance on initialization code in a module

2009-06-16 Thread David Stanek
On Tue, Jun 16, 2009 at 4:54 PM, mrstevegross wrote: > Is there a common way to initialize various stuff in a module? That > is, I have some code in my module that I want to run whenever the > module is imported. Currently, my module looks like this: > > === foo.py === > def something(): >  ... > >

Re: Get name of class without instance

2009-06-24 Thread David Stanek
Try Foo.__name__ if Foo is a class object. On 6/24/09, Bryan wrote: > Given a class: > > class Foo(object): > pass > > How can I get the name "Foo" without having an instance of the class? > > str(Foo) gives me more than just the name Foo. "__main__.Account" > Foo.__class__.__name__ gives m

Re: Unexpected behaviour of inner functions/ decorators

2009-06-30 Thread David Stanek
On Tue, Jun 30, 2009 at 1:44 PM, Francesco Bochicchio wrote: > [snip] > It looks like the decorator uses an older  instance of 'funct', which > does not yet > have the attribute dinamically attached to it. This seem to be > confirmed by the fact that adding the attribute before > rebinding the fu

Re: Looking for the right library for a simple HTTP client

2009-07-10 Thread David Stanek
On Fri, Jul 10, 2009 at 1:29 AM, scriptlear...@gmail.com wrote: > I am trying to implement a simple client that can do the following: > 1)to send the following kinds of HTTP requests and validate responses > 1.1 GET > 1.2 POST with application/x-www-form-urlencoded encoding > 1.3 POST with multipar

Re: How to unbuffer Python's output

2009-07-14 Thread David Stanek
2009/7/14 Lily Gao : > Hi, All > > I am calling a python program in perl and use redirection, > > Like : > > `python x.py > 1.log 2>&1` Try tihs instead: python x.py 2>&1 > 1.log -- David blog: http://www.traceback.org twitter: http://twitter.com/dstanek -- http://mail.python.org/mailman/li

Re: Override a method but inherit the docstring

2009-07-17 Thread David Stanek
On Fri, Jul 17, 2009 at 2:58 AM, Peter Otten<__pete...@web.de> wrote: > Ben Finney wrote: > >> Howdy all, >> >> The following is a common idiom:: >> >>     class FooGonk(object): >>         def frobnicate(self): >>             """ Frobnicate this gonk. """ >>             basic_implementation(self.w

Re: Override a method but inherit the docstring

2009-07-17 Thread David Stanek
On Fri, Jul 17, 2009 at 3:52 AM, Steven D'Aprano wrote: > On Fri, 17 Jul 2009 12:58:48 +1000, Ben Finney wrote: > >>> Using a decorator in this manner requires repeating the super class >>> name.  Perhaps there is a way to get the bases of BarGonk, but I don't >>> think so, because at the time that

Re: Python import Error

2009-07-18 Thread David Stanek
On Sat, Jul 18, 2009 at 3:14 AM, Kalyan Chakravarthy wrote: > Hi All, >    I am using Python 2.6, MySQL 4.0 , I have successfully > Instaled MySQLdb (MySQL-python-1.2.3c1.win32-py2.6) in my system. I tested > through command prompt with "import MySQLdb ", its not shwing any errors >

Re: Changing the private variables content

2009-07-21 Thread David Stanek
On Tue, Jul 21, 2009 at 6:00 PM, Rhodri James wrote: > On Tue, 21 Jul 2009 21:55:18 +0100, Ryniek90 wrote: > >> Hi. >> I'm writing some class, and decided to use inside private method and some >> private variables. While with method i haven't got any problem's with >> variables i have. > > There i

Re: sqlite3 performance problems only in python

2009-07-23 Thread David Stanek
On Thu, Jul 23, 2009 at 9:02 AM, Stef Mientki wrote: > > btw, I don't know if it's of any importance, the SQL-statement I perform is > select OPNAMEN.*, NAME, NAME_, SCORES.SCORE, PATIENT.* >  from OPNAMEN >   inner join POID_VLID          on OPNAMEN.POID            = POID_VLID.POID >   inner join

Re: sqlite3 performance problems only in python

2009-07-23 Thread David Stanek
On Thu, Jul 23, 2009 at 6:29 PM, Stef Mientki wrote: > > but because the same SQL-statement in Delphi performed well, > I thought it was a problem with the Python implementation. Same SQL, but were you also using Sqlite in Delphi? -- David blog: http://www.traceback.org twitter: http://twitter.c

Re: Is "feedparser" deprecated?

2009-08-08 Thread David Stanek
On Fri, Aug 7, 2009 at 3:07 PM, John Nagle wrote: >  Feedparser requires SGMLlib, which has been removed from Python 3.0. > Feedparser hasn't been updated since 2007. Does this mean Feedparser > is dead? > The release is from 2007, but there are several recent commits. http://code.google.com/p/fe

Re: hashability

2009-08-11 Thread David Stanek
On Wed, Aug 12, 2009 at 2:18 AM, Asun Friere wrote: > On Aug 12, 3:32 pm, James Stroud > wrote: > >> You should be more imaginative. > > I'm by no means discounting that there might be some actual problem > you're trying to solve here, but I honestly can't see it. How about a cache? Hashing by id

Re: httplib incredibly slow :-(

2009-08-12 Thread David Stanek
On Tue, Aug 11, 2009 at 4:25 PM, Chris Withers wrote: > Hi All, > > I'm using the following script to download a 150Mb file: > > from base64 import encodestring > from httplib import HTTPConnection > from datetime import datetime > > conn = HTTPSConnection('localhost') > headers = {} > auth = 'Basi

Re: Function to apply superset of arguments to a function

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov wrote: > Hi all, > > I've written a function [1] called apply_some which takes a set of > keywords arguments, filters only those a function is expecting, and > calls the function with only those arguments. This is meant to > suppress TypeErrors - a wa

Re: HTTP POST File without cURL

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 1:57 PM, John D Giotta wrote: > I'm working with an API that allows me to POST a zip file via HTTP and > the documentation uses a cURL example. cURL works, but when I try to > POST the file via python it fails. > I don't want to use cURL (since I'm trying to be transparent an

Re: Function to apply superset of arguments to a function

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 5:03 PM, Mel wrote: > David Stanek wrote: >> On Wed, Sep 9, 2009 at 12:45 PM, Andrey Fedorov >> wrote: > >>> I've written a function [1] called apply_some which takes a set of >>> keywords arguments, filters only those a function is e

Re: Python server locks up

2009-09-09 Thread David Stanek
On Wed, Sep 9, 2009 at 4:28 PM, Zac Burns wrote: > > How would you suggest to figure out what is the problem? > I don't think you said your OS so I'll assume Linux. Sometimes it is more noise than value, but stracing the process may shed light on what system calls are being made. This in turn may