[BangPypers] (no subject)

2020-08-29 Thread Prit Patel
Unsubscribe my email
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2018-10-23 Thread Basu Dubey
PyBITS is back for the third time with an attractive lineup of talks and
workshop.

The conference takes place on Saturday, October 27. For more information on
the talks and speakers visit our website.

There are two workshops being offered on October 28 at PyBITS 2018:

Blockchain and Smart Contracts from First Principle Using Python:
Blockchain is one of the most revolutionary technologies of our times,
which is still maturing and with immense potentials yet to be realised.
While the internet is abuzz with blockchain, the concept is difficult to
comprehend in its entirety. The workshop will help you build a
comprehensive understanding of the subject, with Python being the
programming language.

Basic Python Workshop: This is for those of you who have never tried their
hands at programming or Python. We will be covering Python from the very
basics. This workshop will be FREE for SCHOOL STUDENTS.

Ticket are out.

For registration and more information, visit https://pybits.bits-hyd.org/
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2018-03-21 Thread Kumar Anirudha
Hi All,

This is to announce our upcoming meetup this weekend on Saturday, 24th
March.

The agenda covers:
1. Introduction to Exploratory Data Analysis in Python (Abdul)
2. How beginners can avoid Python pitfalls (Arvind Padmanabhan)
3. State Machines and the excellent transitions library (Kunal Bhagawati)

You can RSVP here [1]

Location:
Myra Medicines,
Metarain Distributors Private Limited,
Hubtown Prime, No. 3/2-5, 4th Floor, Annaswamy Mudaliar Rd, Ulsoor, Rukmani
Colony, Sivanchetti Gardens, Bengaluru, Karnataka 560042
Google Maps Link [2]

In case of any issue, feel free to reach out to me at anirudhst...@gmail.com
 or Abhiram at (abhi.darkn...@gmail.com).

See you all on Saturday.

[1]: https://www.meetup.com/BangPypers/events/qxlhwkyxfbwb
[2]: https://goo.gl/maps/ez5WCoJgXEJ2



Cheers,
Kumar Anirudha
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2017-08-12 Thread Abhishek Vora
Following the success of MUPy (Manipal's Python Developer Conference), 2016
(pypals.org/mupy2016 ), Python Users'
Group (PyPals ) and Linux Users' Group, Manipal (LUGM
) are proud to announce the second annual edition of the
conference.

Following a format similar to PyCon India, MUPy 2017 shall be conducted
over the weekend of October 21st and 22nd. We plan to have workshops, talks
and seminars conducted by professionals in the industry. The speakers will
be sharing their experiences and the endless possibilities of the world of
Python.

MUPy aims to inculcate a sense of passion for the language and development,
nurturing innovation among students.


Event
MUPy (Mew-Pie)
Date
Saturday, October 21, 2017 - Sunday, October 22, 2017
Venue
Manipal, Karnataka, India
Website
https://pypals.org/mupy


The call for proposals for the conference is now open and we invite you to
submit your proposals to propos...@pypals.org by Sunday, September 17th.
The guidelines for the same can be found on pypals.org/proposal
.


Hoping for a great response from an amazing Python community!

Best,
Team PyPals
cont...@pypals.org
facebook.com/pypals 
twitter.com/pypals
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2015-10-16 Thread kracekumar ramaraju
Hi Ankur

 Please use proper subject while posting.

On Fri, Oct 16, 2015 at 11:26 AM, apratim ankur 
wrote:

> Hi Everyone,
>
> There is a small invite-only hacknight at big picther + diamond district
> tonight
> You can register at the link below  :-
> http://bit.ly/meteornow
>
> Regards
> Apratim Ankur
> ___
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>



-- 

*Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus
Torvaldshttp://kracekumar.com *
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2015-10-16 Thread apratim ankur
Hi Everyone,

There is a small invite-only hacknight at big picther + diamond district
tonight
You can register at the link below  :-
http://bit.ly/meteornow

Regards
Apratim Ankur
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2015-06-22 Thread Martin Anto
Please remove from group.

Sorry for the inconvenience caused.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2014-10-30 Thread Tanuj Deshpande
Hi,

Gigstart, Gurgaon is looking for Python Developer. If interested, Please
follow the link below.
https://www.toptalent.in/job/3476/python-developer-intern-new-delhi-india/

Thanks,
Tanuj.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-25 Thread Vineet Naik
On Tue, Sep 24, 2013 at 6:19 PM, Dhananjay Nene dhananjay.n...@gmail.comwrote:

 On Tue, Sep 24, 2013 at 6:11 PM, Dhananjay Nene
 dhananjay.n...@gmail.com wrote:
  On Tue, Sep 24, 2013 at 6:04 PM, Dhananjay Nene
  dhananjay.n...@gmail.com wrote:
  On Tue, Sep 24, 2013 at 5:48 PM, Vineet Naik naik...@gmail.com wrote:
  Hi,
 
  On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:
 
  Hi ,Any XML parser which gives the same kind of data structure as yaml
  parser gives in python.  Tried with xmlmindom but ir's not of a proper
  datastrucure ,every time i need to read by element and create the
 dict.
 
 
  You can try xmltodict[1]. It also retains the node attributes and makes
  than accessible using the '@' prefix (See the example in README of the
 repo)
 
  [1]: https://github.com/martinblech/xmltodict
 
  Being curious I immediately took a look and tried the following :
 
  import xmltodict
 
  doc1 = xmltodict.parse(
  mydocument has=an attribute
and
  manyelements/many
  manymore elements/many
/and
plus a=complex
  element as well
/plus
  /mydocument
  )
 
  doc2 = xmltodict.parse(
  mydocument has=an attribute
and
  manymore elements/many
/and
plus a=complex
  element as well
/plus
  /mydocument
  )
  print(doc1['mydocument']['and'])
  print(doc2['mydocument']['and'])
 
  The output was :
  OrderedDict([(u'many', [u'elements', u'more elements'])])
  OrderedDict([(u'many', u'more elements')])
 
  The only difference is there is only one many node inside the and
  node in doc2. Do you see an issue here (at least I do). The output
  structure is a function of the cardinality of the inner nodes. Since
  it changes shape from a list of many to not a list of 1 but just 1
  element (throwing away the list). Which can make things rather
  unpredictable. Since you cannot predict upfront whether the existence
  of just one node inside a parent node is consistent with the xml
  schema or is just applicable in that particular instance.
 
  I do think the problem is tractable so long as one clearly documents
  the specific constraints which the underlying XML will satisfy,
  constraints which will allow transformations to lists or dicts safe.
  Trying to make it easy without clearly documenting the constraints
  could lead to violations of the principle of least surprise like
  above.
 


The README does mention that it's based on this spec[1] (or
rather a blog post) that has the assumptions. But it seems to be
missing a lot of documentation in general as well.

Out of curiosity I looked into the code to see if the author has left
any comments about this inconsistency (value type varying between lists
and unicode/OrderedDict). While there are no such comments, I found
that the `parse` function can take a keyword arg `dict_constructor`, so
any other dict-like structure can be used instead of OrderedDict.

for eg. to force every node to be inside a list irrespective of the
cardinality -

import xmltodict
from collections import defaultdict

doc2 = xmltodict.parse(
mydocument has=an attribute
  and
manymore elements/many
  /and
  plus a=complex
element as well
  /plus
/mydocument
, dict_constructor=lambda *a, **k: defaultdict(list))

 doc2
defaultdict(type 'list', {u'mydocument': [defaultdict(type 'list',
{u'and': [defaultdict(type 'list', {u'many': [u'more elements']})],
u'plus': [defaultdict(type 'list', {'#text': [u'element as well'], u'@a':
u'complex'})], u'@has': u'an attribute'})]})

 doc2['mydocument'][0]['and'][0]['many']
[u'more elements']

Of course, defaultdict would lead to the order of nodes being lost, but an
OrderedDefaultDict (never tried before :-)) might work.


   It gets even more interesting, eg. below
 
  doc3 = xmltodict.parse(
  mydocument has=an attribute
and
  manyelements/many
/and
plus a=complex
  element as well
/plus
and
  manymore elements/many
/and
  /mydocument
  )
 
  print(doc3['mydocument']['and'])
 
  leads to the output :
 
  [OrderedDict([(u'many', u'elements')]), OrderedDict([(u'many', u'more
  elements')])]
 
  Definitely not what would be naively expected.

 Correction:

 print(doc3['mydocument'])

 prints

 OrderedDict([(u'@has', u'an attribute'), (u'and',
 [OrderedDict([(u'many', u'elements')]), OrderedDict([(u'many', u'more
 elements')])]), (u'plus', OrderedDict([(u'@a', u'complex'), ('#text',
 u'element as well')]))])

 which just trashed the ordering of an and followed by a plus followed by
 an and.


This is a more serious problem particularly if the dict is required to be
serialized back to xml.

Thanks for pointing out these issues, I had missed them entirely :-)

[1]:
http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html

- Vineet


 Dhananjay

 --

 --
 http://blog.dhananjaynene.com twitter: @dnene google plus:
 

Re: [BangPypers] (no subject)

2013-09-25 Thread Dhananjay Nene
On Wed, Sep 25, 2013 at 7:09 PM, Vineet Naik naik...@gmail.com wrote:
 On Tue, Sep 24, 2013 at 6:19 PM, Dhananjay Nene 
 dhananjay.n...@gmail.comwrote:

 On Tue, Sep 24, 2013 at 6:11 PM, Dhananjay Nene
 dhananjay.n...@gmail.com wrote:
[..]

 which just trashed the ordering of an and followed by a plus followed by
 an and.


 This is a more serious problem particularly if the dict is required to be
 serialized back to xml.
= = =
TL;DR. Use domain rather than use cases for exploring data structures
especially where they can cause a lot of change later. Semantic
Consistency is important, don't treat it lightly. Impedance mismatch
can be fragile. If feasible, stay away.
= = =

You probably did not mean this literally, but interpreting it to be so
helps unravel a couple of interesting issues, since it attempts to
reach a judgement based on a use case and doesn't reflect on the
semantics of that data.

a) Do you design a data structure based on a use case or a domain.
I've often preferred to use the underlying domain representation
rather than the minimalistic needed by use cases. eg. When designing
tables, I would choose to not add a column unless it is necessary for
the current use cases. However if the current use cases simplify a
one-to-many relationship to one-to-one, and a reasonable domain
assessment concludes that the relation in the wild is a one-to-many, I
prefer to model it as a one-to-many. That is because over a period of
time more aspects of the domain get implemented and some of these
early decisions need to be revisited. Adding columns to a table is
relatively less expensive than changing the cardinality of table
relationships. (YAGNI proponents may choose to disagree, and thats
fair - I am just stating my opinion here)

Why is it relevant here ? It doesn't matter whether the dict is
required to be serialized back to xml today. What matters more is
whether the domain suggests that ordering is important. I would use
that as deciding factor rather than what operations get done on the
data in the current use cases. If order is unimportant, round tripping
won't hurt, and if it does, just throw xmltodict away.

b) There is yet another issue here. The thread primarily began by
attempting a conversion assuming syntactic equivalence without
verifying semantic compatibility. While JSON / YAML are quite
compatible with each other, XML has a different set of semantics. (and
I don't even refer to some of the issues as discussed at
http://www.w3.org/DesignIssues/XML-Semantics.html and
http://www.balisage.net/Proceedings/vol6/html/Dombrowski01/BalisageVol6-Dombrowski01.html
). I refer to a simple difference. JSON / YAML have two types - a
sequence and a map. The sequence is ordered, the map isn't. Each of
the sequence or a map may contain other primitives or other sequences
or maps. There is no SequenceMap type. A type which has a name, has a
map having key value pairs, but also is a sequence of other
SequenceMaps with potentially not necessarily consecutively repeating
names. There simply isn't any similar pythonic structure (The way I
have worded it make it sound like a structural characteristic rather
than semantics, but I'll continue with that word for the moment).

Why is this relevant ? When one decides on a JSON / YAML file format,
one commits to one set of semantics and when one commits to a XML it
is a different set of semantics. The issue is as the software keeps on
growing a file that is in JSON will more likely continue to grow
differently in terms of its schema than an equivalent XML file. So if
you are the author of the file format just make it a JSON if you want
simple pythonic structures. But if you are choosing to deal with XML
because that format is not in your control, there is a good likelihood
that the maintainer of that file will continue to grow it with XML
semantics in mind, and even if under today's use cases you could find
a way to coerce a XML to primitive python structures like JSON, that
whole approach could break as you go along over the next few years of
maintenance.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-25 Thread steve

On 2013-09-25 17:21, Dhananjay Nene wrote:
On Wed, Sep 25, 2013 at 7:09 PM, Vineet Naik naik...@gmail.com 
wrote:
On Tue, Sep 24, 2013 at 6:19 PM, Dhananjay Nene 
dhananjay.n...@gmail.comwrote:



On Tue, Sep 24, 2013 at 6:11 PM, Dhananjay Nene
dhananjay.n...@gmail.com wrote:

[..]


which just trashed the ordering of an and followed by a plus 
followed by

an and.



This is a more serious problem particularly if the dict is required 
to be

serialized back to xml.

= = =
TL;DR. Use domain rather than use cases for exploring data structures
especially where they can cause a lot of change later. Semantic
Consistency is important, don't treat it lightly. Impedance mismatch
can be fragile. If feasible, stay away.
= = =



Nice one, Dhananjay ! Thanks for spelling out so clearly what feels
instinctively like common sense at times and is just as easy (and 
seductive)

to forget about, at others.


cheers,
- steve

[...snip...]
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-25 Thread Vineet Naik
On Thu, Sep 26, 2013 at 8:58 AM, st...@lonetwin.net wrote:

 On 2013-09-25 17:21, Dhananjay Nene wrote:

 On Wed, Sep 25, 2013 at 7:09 PM, Vineet Naik naik...@gmail.com wrote:

 On Tue, Sep 24, 2013 at 6:19 PM, Dhananjay Nene 
 dhananjay.n...@gmail.com**wrote:

  On Tue, Sep 24, 2013 at 6:11 PM, Dhananjay Nene
 dhananjay.n...@gmail.com wrote:

 [..]


 which just trashed the ordering of an and followed by a plus followed by
 an and.


 This is a more serious problem particularly if the dict is required to be
 serialized back to xml.

 = = =
 TL;DR. Use domain rather than use cases for exploring data structures
 especially where they can cause a lot of change later. Semantic
 Consistency is important, don't treat it lightly. Impedance mismatch
 can be fragile. If feasible, stay away.
 = = =


 Nice one, Dhananjay ! Thanks for spelling out so clearly what feels
 instinctively like common sense at times and is just as easy (and
 seductive)
 to forget about, at others.


+1. Thanks for putting it so clearly.

- Vineet




 cheers,
 - steve

 [...snip...]

 __**_
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/**mailman/listinfo/bangpypershttps://mail.python.org/mailman/listinfo/bangpypers




-- 
Vineet Naik
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Dhananjay Nene
On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:
 Hi ,Any XML parser which gives the same kind of data structure as yaml parser 
 gives in python.  Tried with xmlmindom but ir's not of a proper datastrucure 
 ,every time i need to read by element and create the dict.

Just think about it for a moment. yaml consists of dicts and lists.
xml on the other hand consists of ordered sequences of named nodes
each of which is simultaneously a dict of attributes and a collection
of additional ordered sequences of nodes. Its hard to stuff XML into
native python constructs like dicts and lists. They just don't map
well.

If you could make assumptions about the XML having specific
constraints which would allow it to be cast into dicts and lists, you
could with trivial effort write a transformer to transform a DOM into
a bunch of lists and dicts. In other words - the issue is not the tool
- it is the domain you are dealing with.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Vineet Naik
Hi,

On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:

 Hi ,Any XML parser which gives the same kind of data structure as yaml
 parser gives in python.  Tried with xmlmindom but ir's not of a proper
 datastrucure ,every time i need to read by element and create the dict.


You can try xmltodict[1]. It also retains the node attributes and makes
than accessible using the '@' prefix (See the example in README of the repo)

[1]: https://github.com/martinblech/xmltodict


 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers




-- 
Vineet Naik
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Dhananjay Nene
On Tue, Sep 24, 2013 at 5:48 PM, Vineet Naik naik...@gmail.com wrote:
 Hi,

 On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:

 Hi ,Any XML parser which gives the same kind of data structure as yaml
 parser gives in python.  Tried with xmlmindom but ir's not of a proper
 datastrucure ,every time i need to read by element and create the dict.


 You can try xmltodict[1]. It also retains the node attributes and makes
 than accessible using the '@' prefix (See the example in README of the repo)

 [1]: https://github.com/martinblech/xmltodict

Being curious I immediately took a look and tried the following :

import xmltodict

doc1 = xmltodict.parse(
mydocument has=an attribute
  and
manyelements/many
manymore elements/many
  /and
  plus a=complex
element as well
  /plus
/mydocument
)

doc2 = xmltodict.parse(
mydocument has=an attribute
  and
manymore elements/many
  /and
  plus a=complex
element as well
  /plus
/mydocument
)
print(doc1['mydocument']['and'])
print(doc2['mydocument']['and'])

The output was :
OrderedDict([(u'many', [u'elements', u'more elements'])])
OrderedDict([(u'many', u'more elements')])

The only difference is there is only one many node inside the and
node in doc2. Do you see an issue here (at least I do). The output
structure is a function of the cardinality of the inner nodes. Since
it changes shape from a list of many to not a list of 1 but just 1
element (throwing away the list). Which can make things rather
unpredictable. Since you cannot predict upfront whether the existence
of just one node inside a parent node is consistent with the xml
schema or is just applicable in that particular instance.

I do think the problem is tractable so long as one clearly documents
the specific constraints which the underlying XML will satisfy,
constraints which will allow transformations to lists or dicts safe.
Trying to make it easy without clearly documenting the constraints
could lead to violations of the principle of least surprise like
above.



 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers




 --
 Vineet Naik
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers



-- 
--
http://blog.dhananjaynene.com twitter: @dnene google plus:
http://gplus.to/dhananjaynene
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Vaidik Kapoor
 You can try xmltodict[1]. It also retains the node attributes and makes
 than accessible using the '@' prefix (See the example in README of the
repo)

+1 for xmltodict
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Dhananjay Nene
On Tue, Sep 24, 2013 at 6:04 PM, Dhananjay Nene
dhananjay.n...@gmail.com wrote:
 On Tue, Sep 24, 2013 at 5:48 PM, Vineet Naik naik...@gmail.com wrote:
 Hi,

 On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:

 Hi ,Any XML parser which gives the same kind of data structure as yaml
 parser gives in python.  Tried with xmlmindom but ir's not of a proper
 datastrucure ,every time i need to read by element and create the dict.


 You can try xmltodict[1]. It also retains the node attributes and makes
 than accessible using the '@' prefix (See the example in README of the repo)

 [1]: https://github.com/martinblech/xmltodict

 Being curious I immediately took a look and tried the following :

 import xmltodict

 doc1 = xmltodict.parse(
 mydocument has=an attribute
   and
 manyelements/many
 manymore elements/many
   /and
   plus a=complex
 element as well
   /plus
 /mydocument
 )

 doc2 = xmltodict.parse(
 mydocument has=an attribute
   and
 manymore elements/many
   /and
   plus a=complex
 element as well
   /plus
 /mydocument
 )
 print(doc1['mydocument']['and'])
 print(doc2['mydocument']['and'])

 The output was :
 OrderedDict([(u'many', [u'elements', u'more elements'])])
 OrderedDict([(u'many', u'more elements')])

 The only difference is there is only one many node inside the and
 node in doc2. Do you see an issue here (at least I do). The output
 structure is a function of the cardinality of the inner nodes. Since
 it changes shape from a list of many to not a list of 1 but just 1
 element (throwing away the list). Which can make things rather
 unpredictable. Since you cannot predict upfront whether the existence
 of just one node inside a parent node is consistent with the xml
 schema or is just applicable in that particular instance.

 I do think the problem is tractable so long as one clearly documents
 the specific constraints which the underlying XML will satisfy,
 constraints which will allow transformations to lists or dicts safe.
 Trying to make it easy without clearly documenting the constraints
 could lead to violations of the principle of least surprise like
 above.

It gets even more interesting, eg. below

doc3 = xmltodict.parse(
mydocument has=an attribute
  and
manyelements/many
  /and
  plus a=complex
element as well
  /plus
  and
manymore elements/many
  /and
/mydocument
)

print(doc3['mydocument']['and'])

leads to the output :

[OrderedDict([(u'many', u'elements')]), OrderedDict([(u'many', u'more
elements')])]

Definitely not what would be naively expected.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-24 Thread Dhananjay Nene
On Tue, Sep 24, 2013 at 6:11 PM, Dhananjay Nene
dhananjay.n...@gmail.com wrote:
 On Tue, Sep 24, 2013 at 6:04 PM, Dhananjay Nene
 dhananjay.n...@gmail.com wrote:
 On Tue, Sep 24, 2013 at 5:48 PM, Vineet Naik naik...@gmail.com wrote:
 Hi,

 On Tue, Sep 24, 2013 at 10:38 AM, bab mis bab...@outlook.com wrote:

 Hi ,Any XML parser which gives the same kind of data structure as yaml
 parser gives in python.  Tried with xmlmindom but ir's not of a proper
 datastrucure ,every time i need to read by element and create the dict.


 You can try xmltodict[1]. It also retains the node attributes and makes
 than accessible using the '@' prefix (See the example in README of the repo)

 [1]: https://github.com/martinblech/xmltodict

 Being curious I immediately took a look and tried the following :

 import xmltodict

 doc1 = xmltodict.parse(
 mydocument has=an attribute
   and
 manyelements/many
 manymore elements/many
   /and
   plus a=complex
 element as well
   /plus
 /mydocument
 )

 doc2 = xmltodict.parse(
 mydocument has=an attribute
   and
 manymore elements/many
   /and
   plus a=complex
 element as well
   /plus
 /mydocument
 )
 print(doc1['mydocument']['and'])
 print(doc2['mydocument']['and'])

 The output was :
 OrderedDict([(u'many', [u'elements', u'more elements'])])
 OrderedDict([(u'many', u'more elements')])

 The only difference is there is only one many node inside the and
 node in doc2. Do you see an issue here (at least I do). The output
 structure is a function of the cardinality of the inner nodes. Since
 it changes shape from a list of many to not a list of 1 but just 1
 element (throwing away the list). Which can make things rather
 unpredictable. Since you cannot predict upfront whether the existence
 of just one node inside a parent node is consistent with the xml
 schema or is just applicable in that particular instance.

 I do think the problem is tractable so long as one clearly documents
 the specific constraints which the underlying XML will satisfy,
 constraints which will allow transformations to lists or dicts safe.
 Trying to make it easy without clearly documenting the constraints
 could lead to violations of the principle of least surprise like
 above.

 It gets even more interesting, eg. below

 doc3 = xmltodict.parse(
 mydocument has=an attribute
   and
 manyelements/many
   /and
   plus a=complex
 element as well
   /plus
   and
 manymore elements/many
   /and
 /mydocument
 )

 print(doc3['mydocument']['and'])

 leads to the output :

 [OrderedDict([(u'many', u'elements')]), OrderedDict([(u'many', u'more
 elements')])]

 Definitely not what would be naively expected.

Correction:

print(doc3['mydocument'])

prints

OrderedDict([(u'@has', u'an attribute'), (u'and',
[OrderedDict([(u'many', u'elements')]), OrderedDict([(u'many', u'more
elements')])]), (u'plus', OrderedDict([(u'@a', u'complex'), ('#text',
u'element as well')]))])

which just trashed the ordering of an and followed by a plus followed by an and.

Dhananjay

-- 
--
http://blog.dhananjaynene.com twitter: @dnene google plus:
http://gplus.to/dhananjaynene
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2013-09-23 Thread bab mis
Hi ,Any XML parser which gives the same kind of data structure as yaml parser 
gives in python.  Tried with xmlmindom but ir's not of a proper datastrucure 
,every time i need to read by element and create the dict.  
   
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2013-09-23 Thread Noufal Ibrahim
bab mis bab...@outlook.com writes:

 Hi ,Any XML parser which gives the same kind of data structure as yaml
 parser gives in python.  Tried with xmlmindom but ir's not of a proper
 datastrucure ,every time i need to read by element and create the
 dict.

lxml probably. The ElementTree API in the standard library gives you
an API better than than the DOM ones but that's not saying much.
[...]


-- 
Cordially,
Noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2011-09-15 Thread Nikunj Badjatya
+1

:)




On Mon, Sep 12, 2011 at 7:34 PM, AKARSH SANGHI akarsh.san...@gmail.comwrote:

 Hey, here's a great video with Python in it.

 http://youtu.be/1lBeungEnx4

 Although it's also about matlab.

 --

 Akarsh Sanghi
 Jaypee Institute of Information Technology University
 Undergraduate Student Class of 2013
 Mob: (+91)-9818489945
 Email: akarsh.san...@gmail.com
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] (no subject)

2011-09-12 Thread AKARSH SANGHI
Hey, here's a great video with Python in it.

http://youtu.be/1lBeungEnx4

Although it's also about matlab.

-- 

Akarsh Sanghi
Jaypee Institute of Information Technology University
Undergraduate Student Class of 2013
Mob: (+91)-9818489945
Email: akarsh.san...@gmail.com
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2009-02-17 Thread Baiju M
On Tue, Feb 17, 2009 at 2:37 PM, Senthil Kumaran orsent...@gmail.com wrote:
 Guys, let us please settle it here. ( Even though, I may not attend
 the coming week, here are my points)

 1) No more administrative tasks than it is required. Wiki is just
 fine.  No Google Calender and No Meetups. Friend brings his friend and
 we all are friends. ;)

 2) Lets have it at ZeOmega. Baiju took the initiative and has made
 arrangements for it.
 The point of this meet up is to get going. Once we have a couple of
 meetings, then we can think of switching to different places in and
 around the city.

 Yeah, I agree with Anand that morning meetings is next to impossible.

 Evening 4:00 pm to 6/7 pm is the suitable timing.

Anyway this Saturday afternoon I won't be available.  Let's change
venue to ToughtWorks.
I have been two times to ToughtWorks for BangPypers meeting, they are
good hosts.
So, now we can stop that voting.

Regards,
Baiju M
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] (no subject)

2009-02-17 Thread Baiju M
On Tue, Feb 17, 2009 at 3:10 PM, Baiju M mba...@zeomega.net wrote:
 On Tue, Feb 17, 2009 at 2:37 PM, Senthil Kumaran orsent...@gmail.com wrote:
 Guys, let us please settle it here. ( Even though, I may not attend
 the coming week, here are my points)

 1) No more administrative tasks than it is required. Wiki is just
 fine.  No Google Calender and No Meetups. Friend brings his friend and
 we all are friends. ;)

 2) Lets have it at ZeOmega. Baiju took the initiative and has made
 arrangements for it.
 The point of this meet up is to get going. Once we have a couple of
 meetings, then we can think of switching to different places in and
 around the city.

 Yeah, I agree with Anand that morning meetings is next to impossible.

 Evening 4:00 pm to 6/7 pm is the suitable timing.

 Anyway this Saturday afternoon I won't be available.  Let's change
 venue to ToughtWorks.
 I have been two times to ToughtWorks for BangPypers meeting, they are
 good hosts.
 So, now we can stop that voting.

I have changed the venue and timing (4pm to 7pm) here:
http://wiki.python.org/moin/BangPypers/Meeting21Feb2009

Please see the address and other details and make any any correction,
if required.

Regards,
Baiju M
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers