Re: Strong typing implementation for Python

2015-10-11 Thread Vladimir Ignatov
Hi,

> You might like to investigate Boo, which is a .NET-based
> language with a Python-like syntax:

AFAIK Unity just dropped Boo support from version 5.0 because
virtually nobody used it. Those little known niche languages are
destined to extinct.

Interesting language is Apple's Swift. While it's statically typed
language, type specification is optional as far as compiler can figure
out type. That gives an interesting feeling because you don't need to
type types all over but in the same time you have all type checking we
normally expect from statically typed language. The syntax is not
pythonic but overall it looks like language got some influence from
Python.

Vladimir


http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-08 Thread Vladimir Ignatov
>> I had some experience programming in Lua and I'd say - that language
>> is bad example to follow.
>> Indexes start with 1  (I am not kidding)
>
> What is so bad about that?

It's different from the rest 99.9% of languages for no particular reason.

( => perfect example of "design smell" => not a good example to follow)


Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-04 Thread Vladimir Ignatov
> To me, marking a variable as global in a large number of functions is
> a code smell that indicates that you're probably overusing globals.
> Lua is an example of a language that takes the opposite approach: in
> Lua, every variable is global unless you explicitly mark it as local.
> Lua is a fine language overall, but that is one of my pet peeves with

I had some experience programming in Lua and I'd say - that language
is bad example to follow.
Indexes start with 1  (I am not kidding)
Single data type ("table") which could suddenly flip from "list" to
"map" because you deleted one item.
Has objects but has no classes.
and so on...

Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: Strange location for a comma

2015-09-03 Thread Vladimir Ignatov
>>
>> # On appelle la fonction setup
>> setup(
>>name = "salut",
>>version = "0.1",
>>description = "Ce programme vous dit bonjour",
>>executables = [Executable("salut.py")],#  <--- HERE
>> )
>>
>>
>
> Ok its understood, it's a 1 element only tuple
>
> example:
>
 A = 5,
 A
>
> (5,)
>
 A = (6)
 A
>
> 6

No. It's not a tuple in your case (calling 'setup' function)

a = 1,2,  # <- extra comma
print a
b = 1,   # <- extra comma
print b

=>

(1, 2)  # ignored
(1,)# made tuple

and

def f(a, b):
print a,b

f(1,2,)   # <- extra comma

=>

1 2  # ignored

Under some circumstances python ignores "excess" comma. At least
inside list definition [1,2,3,]  and function calls f(1,2,)

Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2015-09-02 Thread Vladimir Ignatov
Hi,

my 0.02

I don't personally use globals. And don't like "object oriented" code
(my code more inclined toward "functional" style). But sometimes I
feel like passing various minor values (like settings) all around app
via regular parameters is just too much work.  So I use
"pseudo-global" object which holds various stuff in its attributes.
And I pass that object around my code. But that is just one parameter,
not myriads of them.

Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: packing unpacking depends on order.

2015-09-02 Thread Vladimir Ignatov
 b, a[b] = a[b], b

Nice. If I ever notice that kind of code in our codebase I'll  1)
check file history to find out the "author"  2) ask that guy to remove
it immediately :-)


Vladimir

http://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to handle cpu cache in python ( or fastest way to call a function once)

2015-08-23 Thread Vladimir Ignatov
Hi,

>> for i in range(100): #just to create a time interval, seems this disturb 
>> cpu cache?
>> pass

Python interpreter consumes memory quite extensively because
"everything is object".  So constructions like:

range(100):

_take_ memory.  Additionally it will trigger garbage collecting code
on deallocation time so expect even more delay.
To get most out of Python - all "numbers crushing" / "pixel pushing" /
"store gigabytes" code should go to low-level compiled binary
libraries.


Vladimir

https://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Old DbaseV DOS Programmer wants to step over to new/actual modern program software

2015-08-16 Thread Vladimir Ignatov
On Sun, Aug 16, 2015 at 1:11 PM, Rustom Mody  wrote:

>> I have some ideas in mind like Java with (ECLIPS) because it is very 
>> popular, it is the most widely used and can get tutorials and videos all 
>> over the internet.
>> I've read a lot of good things about Python, that it is much easier but too 
>> complicate to define what to choose,
>> at the first place witch version 2.x or 3.x, a lot of IDE's to choose from, 
>> beside of that witch IDE with what pluggin.

Hi,

I am using python for years but still curious about best IDE to suggest newbies.
IMHO - too many choices with no clear winner and each with its own flaws.
For me two crucial features are: good autocompletion and ability to
step over code in debugger.
I'd try Eclipse+PyDev first and then additionally check PyCharm ($$$)
for comparison (to see how "best free" compares to "good commercial")


Vladimir

https://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: looking for standard/builtin dict-like data object

2015-08-11 Thread Vladimir Ignatov
>>> I also thought the stdlib had some kind of "namespace" class with this
>>> kind
>>> of API, but I can't find it now:-(
>>
>>
>> It does - types.SimpleNamespace(). It accepts keyword arguments, and
>> will let you create more attributes on the fly (unlike a namedtuple).
>
>
> Yes, that's it. Thanks!
>

Ah, sad, sad, sad.  We unfortunately stuck with built-in Python 2.6.x
in our system.  I see from docs that SimpleNamespace is rather new
creation (3.3+).  I know 'namedtuple' way, but don't like it as I
prefer freedom in attribute creation/mutation.  Looks like I have to
stuck with handmade solution for now.

Anyway - thanks a lot for everybody!


Vladimir
https://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


looking for standard/builtin dict-like data object

2015-08-10 Thread Vladimir Ignatov
Hi,

In my code I often use my own home-brewed object for passing bunch of
data between functions. Something like:

class Data(object):
def __init__ (self, **kwargs):
self.__dict__ = kwargs




return Data(attr1=..., attr2=..., attr3=...)

Logically it works like plain dictionary but with nice result.attrX
syntax on client side (instead of resut['attrX']).   Overall I am
pretty happy with this approach except that I need to drag Data class
around my projects and import its module in every code producing data.

I am curious if anybody knows similar "dummy" class located in
standard libraries? I'd be glad to use it instead.




Thanks,
Vladimir
https://itunes.apple.com/us/app/python-code-samples/id1025613117
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tools for refactoring/obfuscation

2012-03-26 Thread Vladimir Ignatov
Hi,

(sorry for replying to the old topic)

On Tue, Mar 6, 2012 at 10:29 PM, Javier  wrote:
> I am looking for an automated tool for refactoring/obfuscation.
> Something that changes names of functions, variables, or which would
> merge all the functions of various modules in a single module.
> The closest I have seen is http://bicyclerepair.sourceforge.net/
>
> Does somebody know of something that can work from the command line or
> simple data structures/text files?, like a python dictionary of functions
> {"old":"new",...}

I am not surprised what nobody answers. I think that such tool is
nearly impossible given the dynamic Python's nature.
But if you put little discipline/restrictions in your source code,
when doing obfuscation could be much more easier. Almost trivial I
would say.

Javier, you can contact me directly if you are interested in this topic.

Vladimir Ignatov
kmisoft at gmail com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyCharm

2010-10-14 Thread Vladimir Ignatov
Hello,

> One thing that bugs me in refactoring though is that renaming a method or 
> variable does not necessarily work. It's supposed to track down all 
> >references and correctly change them, but it tends to be hit or miss.

Since we got a true dynamic language here (Python) I don't see a way
how a "perfect" refactoring can be done even in a theory. PyDev tends
to do the very same things. Okay, at least that saves me $199. Not
bad.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-04 Thread Vladimir Ignatov
> http://sourceforge.net/mailarchive/message.php?msg_name=9c768dc61001121642t5bd1a7ddmd1fe9e088e1d9...@mail.gmail.com

Thanks a lot! That is a great reference (a must read for everybody
interested). Reading just this: "Internally at Google we have a
language-neutral representation shared by all our language analyzers,"
make me jumping ;-)  Googlers can't be wrong.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-04 Thread Vladimir Ignatov
> That is partially why I created this search engine for python, to see
> what parameters other people feed in.
> http://nullege.com/

Thank you for excellent effort! I found it very useful and start using
it on almost everyday basis. It's much simple to learn from real live
examples.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
>> > […] system "knows" all your identifiers and just regenerates
>> > relevant portions of text from internal database-alike
>> > representation.
>
> You will probably want to learn about “refactoring” to see if that's
> related to what you mean http://www.refactoring.com/>.

I mean if system actually "understands" your code (instead of try to
figure it out from existing text files with source code), then much
more complex refactoring is possible. My favorite refactoring is
"Replace Method with Method Object". It is hard to imagine "external"
tool that can provide such refactoring for python code.

>> Something like Bicycle Repair Man then:
> Bicycle Repair Man has not shown any development activity since 2004.
> Which is a shame, because it's an awesomely appropriate name for what it
> does :-)

I believe it still live under the hood of PyDev plugin. I use it
almost every day and need to say that it don't provide much more than
simple renaming (which works right in 80% of cases in recent version).


Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
> I guess Vladimir means what's called a structure editor. The (by me)
> aforementioned Synthesizer Generator is an example of such an editor
> (environment).

Maybe. Yes, it kind of "generator". It has (entered somehow) internal
representation of target program. Then it generates code out of this
internal data. Yes, it is imaginable system, I don't have any working
prototype yet. But about to start making it. For prototype I choose
python 2.x as implementation language, sqlite as internal database and
Django as UI.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
> can you sketch an example/use case more concretely?

Sorry, I don't have anything written down. I just have some rough idea
of implementation and some concrete features I would like to see in
such system.  For example:

1) Instant refactoring. No more needs for manual
search/inspect/rename. Since system knows exactly that is going on,
the refactoring will be fully automatic.
2) Show "xref table" for each function. How often this function used?
Where is it used? (code snippets of calls) What functionality is
supported by this function?
3) Extended statistics. How many objects this object/function
interacts with? Popular functions, dead/unused functions.
4) Code smell detector - too long functions, too much interaction with
other objects, global objects, etc.
...

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
>> Imagine simple operation like "method renaming" in a simple "dumb"
>> environment like text editor + grep. Now imagine how simple it can be
>> if system "knows" all your identifiers and just regenerates relevant
>> portions of text from internal database-alike representation.
>>
>
> I think every IDE (not older than 20 years) does that already.

And fix every reference to it in all files? For python? I don't think
so. I even don't think this is possible at all. That if several
different objects have a similar named method? How will IDE "classify"
calls and renames only some of calls and not others?

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
> I don't see what the advantage of the use of a database is in a fairly
> linear hierarchical structure like python objects and modules.

Imagine simple operation like "method renaming" in a simple "dumb"
environment like text editor + grep. Now imagine how simple it can be
if system "knows" all your identifiers and just regenerates relevant
portions of text from internal database-alike representation.

> You mean something like LabView ?

No, I don't think so. I never use LabView but imagine it something
very "graphical-oriented". No, I think about more "classic" text view.
But back-ended with "smart" underlying system - not just obvious
"text".

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
> The maintenance thing may be true but for me that doesn't outweigh the
> clear benefits I get from using Python i.s.o. e.g. C++: the fact that
> I have much less code that is more compact and for me more directly
> readable is a clear advantage when doing maintance on code I didnt
> touch for a while. Documenting the essential parameters used with some
> examples and some logging helps (for me at least...).

Python is very easy to write. But with code grow and time passes,
things get worse. Currently I tries to reanimate one of my old
freeware project and faced it again.

> The type of IDE you are looking for is more something like Rational
> Rose (e.g. RRT?) type of tooling perhaps? There you "CAD" components
> and their statebehavior and the system generates C or C++ code.

Perhaps. I newer use Rational Rose but hear about it. But I use some
other Rational* products and they scare me a lot. So maybe Rose can be
used for "inspiration" but not much more.  Actually I don't want to
put programmer in GUI-fashioned env. with a lot of buttons and
switches. I think about "classic" text-like view but that actually
"understands" that are you doing (typing) on. So your types goes in
"datastore" first and then renders back as a text representation.
Something like this.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
> This is obvious even in the Python documentation itself where one
> frequently asks oneself "Uhh... so what is parameter X supposed to be...
> a string... a list... ?"

Exactly. Often I don't need to know the exact type, but to figure out
that "kind of type" it is.

>> should be a database-centric and resemble current CAD systems instead
>> of being just "fancy text editor". Source text should be an output
>> product of that CAD and not a "source material" itself.
>
> Ugh, please NO!  This has been attempted many many times in many
> environments - it always fails *terribly*.

Can you give some examples of such systems? (maybe just names for
googling for)  I don't see anything dirt in storing some additional
meta-information about the code under development and using it later
for all kind of benefits (easy refactoring for example). As with your
example with "parameter x", some additional information can be
"attached" to this paramer. Later it can be used during
code-generation phase and placed as "comment" in source code or placed
in popup tag in html-style presentation.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Dreaming of new generation IDE

2010-02-03 Thread Vladimir Ignatov
Hello,

I am sitting here for quite some time, but usually keep silent ;-) I
use Python since 2003 both "professionally" and for my hobby projects
and love it a much.
I notice however, that "maintaining" existing/older python code is may
be not so enjoyable task. It may be even harder than supporting old
code written in some type of "static" languages (like Java or C++).
Surely "dynamic" nature of python comes with price.

Finally I develop a feeling that strong instrumentation / tools can
bring us the best of two worlds. That I am dreaming on is an absolute
new type/class of IDE suitable for Python and potentially for other
dynamic-type languages. Instead of current text-oriented IDEs, it
should be a database-centric and resemble current CAD systems instead
of being just "fancy text editor". Source text should be an output
product of that CAD and not a "source material" itself.

Well. I understand that it is a very ambitious and experimental stuff.
Great efforts and motivation needed even to get something "runnable".
So I am looking for someone to get in kind of "virtual partnership".
If someone interesting it that soft of stuff, I would like to talk and
discuss this system.

Vladimir Ignatov
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A beginner question about GUI use and development

2009-11-13 Thread Vladimir Ignatov
Hi,

I have working with wxPython since about 2003 and still have a "mixed"
feeling about it. Periodically I was catched in some traps especially
in graphics-related parts of my code (just one example: try to find
documentation about DC.Blit behaviour then UserScale != 1.0).   For
fresh-starters I would recommend to try a PyQT first (IMHO good
commercial background/support is a big plus for any open-source
project). Another option (my person choise so far) is to switch to
web-based interface. My personal choice - web based interface using
Django.

Vladimir Ignatov

>> Hi!
>> I have written som Python programs but no one with a GUI yet,
>> i have look around and found a lot of diffrent gui module.
>>
>> I will develop program that will use a small amout of GUI part
>> eg. program to show status about server etc.
>>
>> I have looked att wxWidget, but i like a rekommendation here
>> (Will develop Windows program but somtimes OSX to)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help resolve a syntax error on 'as' keyword (python 2.5)

2009-11-03 Thread Vladimir Ignatov
Hi,

"except Exception as variable"

is a new python-3 syntax.

You should use "except Exception, variable" syntax in 2.x series.

Vladimir Ignatov



On Tue, Nov 3, 2009 at 4:06 PM, Oltmans  wrote:
> Hi, all. All I'm trying to do is to print the error message using the
> following code (copying/pasting from IDLE).
>
> def div(a,b):
>        print a/b
>
>
> try:
>    div(5,0)
> except Exception as msg:
>    print msg
>
> but IDLE says (while highlighting the 'as' keyword)
> except Exception as msg:
>
> SyntaxError: invalid syntax
>
> I've searched the internet and I'm not sure what can cause this. Any
> help is highly appreciated. I'm using Python 2.5 on Windows XP.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Business issues regarding adapting Python

2009-09-30 Thread Vladimir Ignatov
>> Python-related programming job. Positions both very rare (comparing
>> with Java/C++ - maybe 1/100) and not pays well. And about 99% of them
>> are web+Django.
>
> To who/what are you replying?

Nope. Just a replic.
BTW I agreed - just peek a good programmers and let them learn python.
Literally in a days they will be able to write "average" production
code. Don't expect hovewer that this code will be a very "pythonic".
Especially from guys with strong C++ - like background.  My advise -
show em a "generators". IMHO that is a mindblowing feature for
everybody who get up from static-type languages.

Vladimir
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Business issues regarding adapting Python

2009-09-28 Thread Vladimir Ignatov
Ha-ha-ha (sorry, can't resist).

Here is at Moscow/Russia I have had a tought time finding a
Python-related programming job. Positions both very rare (comparing
with Java/C++ - maybe 1/100) and not pays well. And about 99% of them
are web+Django.
-- 
http://mail.python.org/mailman/listinfo/python-list